本文整理汇总了C#中Interaction类的典型用法代码示例。如果您正苦于以下问题:C# Interaction类的具体用法?C# Interaction怎么用?C# Interaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Interaction类属于命名空间,在下文中一共展示了Interaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
player = this.gameObject;
playerCamera = GameObject.FindGameObjectWithTag(Tags.camera);
playerRigidbody = GetComponent<Rigidbody>();
playerInteraction = GetComponent<Interaction>();
}
示例2: ShouldReturnStrictMockOfCorrectType
public void ShouldReturnStrictMockOfCorrectType()
{
Interaction i = new Interaction();
object mock = i.CreateStrictMock<StrictMockSpec>();
Specify.That(mock.GetType().FullName).ShouldEqual("NBehave.Spec.Framework.Specification.Mocks.__Proxy__StrictMockSpec");
}
示例3: HandledInteractionsShouldNotCauseException
public void HandledInteractionsShouldNotCauseException()
{
var interaction = new Interaction<Unit, bool>();
interaction.RegisterHandler(c => c.SetOutput(true));
interaction.Handle(Unit.Default).FirstAsync().Wait();
}
示例4: ShouldCreateStrictInstanceOfInterfaceWithDefaultCtor
public void ShouldCreateStrictInstanceOfInterfaceWithDefaultCtor()
{
Interaction i = new Interaction();
IMockable fooMock = i.CreateStrictMock<IMockable>();
Specify.That(fooMock).ShouldNotBeNull();
}
示例5: ChangeState
public void ChangeState(Interaction.interactionType type, bool b)
{
//Debug.Log(tag);
switch (tag)
{
case "Openable":
StartCoroutine(Open(b));
break;
case "Lightable":
StartCoroutine(Light(b));
break;
case "InteractableWater":
StartCoroutine(Water(b));
break;
case "InteractableRock":
StartCoroutine(Rock(b));
break;
case "DeadTree":
if(type == Interaction.interactionType.LEAVES)
{
StartCoroutine(Leaves(b));
}
else
{
StartCoroutine(Flower(b));
}
break;
}
}
示例6: HandlersCanOptNotToHandleTheInteraction
public void HandlersCanOptNotToHandleTheInteraction()
{
var interaction = new Interaction<bool, string>();
var handler1A = interaction.RegisterHandler(x => x.SetOutput("A"));
var handler1B = interaction.RegisterHandler(
x => {
// only handle if the input is true
if (x.Input) {
x.SetOutput("B");
}
});
var handler1C = interaction.RegisterHandler(x => x.SetOutput("C"));
using (handler1A) {
using (handler1B) {
using (handler1C) {
Assert.Equal("C", interaction.Handle(false).FirstAsync().Wait());
Assert.Equal("C", interaction.Handle(true).FirstAsync().Wait());
}
Assert.Equal("A", interaction.Handle(false).FirstAsync().Wait());
Assert.Equal("B", interaction.Handle(true).FirstAsync().Wait());
}
Assert.Equal("A", interaction.Handle(false).FirstAsync().Wait());
Assert.Equal("A", interaction.Handle(true).FirstAsync().Wait());
}
}
示例7: ShouldCreateStrictInstanceOfAbstractType
public void ShouldCreateStrictInstanceOfAbstractType()
{
Interaction i = new Interaction();
MockableBase fooBaseMock = i.CreateStrictMock<MockableBase>();
Specify.That(fooBaseMock).ShouldNotBeNull();
}
示例8: Initialize
private void Initialize(Interaction interaction)
{
try
{
// Create new session vm
var sessionvm = new RecursiveLabsSessionViewModel(interaction);
// Add urls to VM
foreach (var url in RecursiveLabsButton.Urls)
{
// Make sure it doesn't think it's selected
url.IsSelected = false;
// Add to list
sessionvm.Urls.Add(url);
}
// Set to data context
DataContext = sessionvm;
}
catch (Exception ex)
{
Console.WriteLine(ex);
RecursiveLabsAddin.AddinTracer.Exception(ex);
}
}
开发者ID:InteractiveIntelligence,项目名称:RecursiveLabsIntegration,代码行数:26,代码来源:RecursiveLabsDialog.xaml.cs
示例9: TennisActor
public TennisActor(string code, string prefab, Vector3 position, bool hidden, Interaction interaction)
: base(position, hidden)
{
this.prefab = prefab;
this.code = code;
this.interaction = interaction;
}
示例10: InteractionRay
private void InteractionRay()
{
RaycastHit ray;
if (Physics.Raycast(cameraT.position, cameraT.forward, out ray, interactMaxDist, (int)Mathf.Pow(2, 8)))
{
Debug.DrawLine(cameraT.position, ray.point, Color.yellow, 0f, true);
interaction = FindInteraction(ray);
if (Input.GetButtonUp("Use"))
{
switch (interaction)
{
case Interaction.Terminal:
Terminal terminal = ray.collider.GetComponent<Terminal>();
terminal.Use();
break;
case Interaction.Number:
GameFragment fragment = ray.collider.GetComponent<GameFragment>();
_Game.CollectNumber(fragment.Use());
break;
case Interaction.Collectable:
//break;
default:
break;
}
}
}
else
{
interaction = Interaction.None;
}
}
示例11: Start
// Use this for initialization
void Start ()
{
playerInteraction = GameObject.FindGameObjectWithTag("Player").GetComponent<Interaction>();
myText = this.GetComponent<Text>();
}
示例12: Update
void Update()
{
if (interaction==null)
{
interaction = GameObject.Find("Player").transform.FindChild("Main Camera").GetComponent<Core>().interaction;
if (interaction != null)
{
interaction.addInteractionObject(this.gameObject, delegate()
{
OnMouseDown();
}, delegate()
{
gameObject.renderer.material = iluminated;
}, delegate()
{
gameObject.renderer.material = normal;
});
}
}
play = Mathf.PingPong(Time.time, 3);
if (play > 2.9)
{
particle.emit = true ;
}
else
{
particle.emit = false;
}
}
示例13: Start
// GameObject interactionObject;
// private Component interaction;
// Use this for initialization
void Start()
{
interaction = GameObject.Find ("Root").GetComponent <Interaction> ();
// Call script to apply settings that depend on platform (eg touch vs mouse)
if (!applyPlatformSettings ())
interaction.debugMessage ("Platform settings failed", 3.0f);
}
示例14: UnhandledInteractionsShouldCauseException
public void UnhandledInteractionsShouldCauseException()
{
var interaction = new Interaction<string, Unit>();
Assert.Throws<UnhandledInteractionException<string, Unit>>(() => interaction.Handle("foo").FirstAsync().Wait());
interaction.RegisterHandler(_ => { });
interaction.RegisterHandler(_ => { });
Assert.Throws<UnhandledInteractionException<string, Unit>>(() => interaction.Handle("foo").FirstAsync().Wait());
}
示例15: ShouldReturnStrictMockWhenSupplyingCtorArgs
public void ShouldReturnStrictMockWhenSupplyingCtorArgs()
{
Interaction i = new Interaction();
StrictMockSpec mock = i.CreateStrictMock<StrictMockSpec>(5, "Test");
Specify.That(mock.i).ShouldEqual(5);
Specify.That(mock.s).ShouldEqual("Test");
Specify.That(mock.GetType().FullName).ShouldEqual("NBehave.Spec.Framework.Specification.Mocks.__Proxy__StrictMockSpec");
}