本文整理汇总了C#中RAIN类的典型用法代码示例。如果您正苦于以下问题:C# RAIN类的具体用法?C# RAIN怎么用?C# RAIN使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RAIN类属于命名空间,在下文中一共展示了RAIN类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
Animator animator = ai.Body.GetComponent<Animator>();
animator.SetBool("run", true);
NavMeshAgent myAgent = ai.Body.GetComponent<NavMeshAgent>();
Vector3 myDestiny = ai.WorkingMemory.GetItem<Vector3>("destination");
Vector3 myPos = ai.Body.transform.position;
float distance = Vector3.Distance(myPos, myDestiny);
float myRadius = ai.Body.GetComponent<CapsuleCollider>().radius;
//Debug.Log ("distance" + distance);
//Debug.Log ("my rad" + myRadius);
//Debug.Log ("-------------------------------------");
//if the cop has reached his destination, search for a bit
if(distance < 1 ){
ai.WorkingMemory.SetItem<bool>("isSearching", true);
//ai.WorkingMemory.SetItem<bool>("hasDestination", false);
//Debug.Log ("MOVE ON TO SEARCHING");
return ActionResult.SUCCESS;
}
return ActionResult.RUNNING;
}
示例2: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
ai.Motor.Stop ();
VariableManager.StartInteractingWithPlayer (ai);
//Vector3 targetPosition = ai.WorkingMemory.GetItem<Vector3>("player") - ai.Body.transform.forward;
return ActionResult.SUCCESS;
}
示例3: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
_Time = _Time + Time.deltaTime;
float phase = Mathf.Sin(_Time / _Period);
ai.Kinematic.Rotation = new Vector3(0, phase * _Angle, 0);
return ActionResult.SUCCESS;
}
示例4: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
NPC npc= ai.Body.GetComponent<NPC>();
npc.AnimRange=NPC.AI_ANIM_ATTACK_BASH;
//gob.executeAttack();
return ActionResult.SUCCESS;
}
示例5: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
if (!targetObject)
return ActionResult.FAILURE;
//Resource 를 Target 에 전달
GameObject agent = ai.Body;
Component cpnt = agent.GetComponent<CInventory>();
if (cpnt)
{
ArrayList item = ((CInventory)cpnt).PopItem("Resource");
cpnt = targetObject.GetComponent<CInventory>();
if (cpnt)
{
((CInventory)cpnt).AddItem("Resource", item);
}
}
else
{
return ActionResult.FAILURE;
}
return ActionResult.SUCCESS;
}
示例6: Start
public override void Start(RAIN.Core.AI ai)
{
R = Random.Range (0.0f, 1.0f);
G = Random.Range (0.0f, 1.0f);
B = Random.Range (0.0f, 1.0f);
base.Start(ai);
}
示例7: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
//ai.WorkingMemory.GetItem<Vector3>("moveStartPoint");
ai.WorkingMemory.SetItem<Vector3>("MoveTarget",ai.WorkingMemory.GetItem<Vector3>("moveStartPoint"));
//ai.WorkingMemory.SetItem<bool>("isMovingRandom",false);
return ActionResult.SUCCESS;
}
示例8: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
GameObject agent = ai.Body;
Vector2 target = ai.WorkingMemory.GetItem<Vector2>("WanderTarget");
Vector2 position = agent.transform.position;
if (position != beforePos)
{
return ActionResult.FAILURE;
}
Vector2 move = (target - position).normalized * moveSpeed * ai.DeltaTime;
agent.transform.Translate(move);
ai.Motor.UpdateMotionTransforms();
beforePos = agent.transform.position;
if ( (position - target).magnitude < 0.1f)
{
return ActionResult.SUCCESS;
}
else
{
return ActionResult.RUNNING;
}
}
示例9: Start
public override void Start(RAIN.Core.AI ai)
{
base.Start(ai);
_lastRunning = 0;
m_TurretController = ai.Body.GetComponent<TurretController>();
}
示例10: Start
public override void Start(RAIN.Core.AI ai)
{
base.Start(ai);
m_Angle = 0.0f;
m_TurretController = ai.Body.GetComponent<TurretController>();
m_Turret = m_TurretController.m_ShellSpawner.transform.parent.gameObject;
}
示例11: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
_allMatches = suspects.Evaluate<IList<RAIN.Entities.Aspects.RAINAspect>>(ai.DeltaTime, ai.WorkingMemory);
if (_allMatches == null || _hellephant == null)
{
ai.WorkingMemory.SetItem<GameObject>(boyObject.VariableName, null);
return ActionResult.FAILURE;
}
AIRig attackedAI = _hellephant.GetComponentInChildren<AIRig>();
_attacker = attackedAI.AI.WorkingMemory.GetItem<GameObject>("attacker");
GameObject result = null;
Debug.Log("isIn:\n\tCount: " + _allMatches.Count);
foreach (RAIN.Entities.Aspects.RAINAspect aspect in _allMatches)
{
Debug.Log("isIn:\n\tTAG: " + aspect.Entity.Form.tag);
if (aspect.Entity.Form.GetInstanceID() == _attacker.GetInstanceID())
{
result = _attacker;
break;
}
}
ai.WorkingMemory.SetItem<GameObject>(boyObject.VariableName, result);
return ActionResult.SUCCESS;
}
示例12: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
if( ai.Body.GetComponent<Passant>().sceneLeader.GetComponent<Musicien>()!=null)
return ActionResult.SUCCESS;
else
return ActionResult.FAILURE;
}
示例13: Start
public override void Start(RAIN.Core.AI ai)
{
//Change the FOV Color
FOV2DVisionCone FOV = ai.Body.transform.Find("FOV2D").GetComponent<FOV2DVisionCone>();
FOV.status = FOV2DVisionCone.Status.Idle;
base.Start(ai);
}
示例14: Execute
public override ActionResult Execute(RAIN.Core.AI ai)
{
RAINSensor sensor = ai.Senses.GetSensor("AttackRangeSensor");
Vector3 targetPos = TargetPos.Evaluate<Vector3>(ai.DeltaTime, ai.WorkingMemory);
float speed = MoveSpeed.Evaluate<float>(ai.DeltaTime, ai.WorkingMemory);
float range = Range.Evaluate<float>(ai.DeltaTime, ai.WorkingMemory);
float distanceToTarget = Vector3.Distance(ai.Body.transform.position, targetPos);
if (distanceToTarget > range)
{
Vector3 dirToTarget = targetPos - ai.Body.transform.position;
dirToTarget *= range/dirToTarget.magnitude;
ai.Motor.Speed = speed;
ai.Motor.MoveTo(ai.Body.transform.position + dirToTarget);
m_TurretController.TurnTurretForward();
}
else
{
targetPos.y = m_TurretController.Turret.transform.position.y;
m_TurretController.TurretLookAt(targetPos);
}
return ActionResult.SUCCESS;
}
示例15: Execute
public override RAIN.Action.Action.ActionResult Execute(RAIN.Core.Agent agent, float deltaTime)
{
SetVariables(agent);
if(isPlayer == 1)
return RAIN.Action.Action.ActionResult.SUCCESS;
/*if(unit == null)
unit = agent.Avatar.GetComponent<Unit>();
Unit nearestEnemy = unit.DetectEnemies(agent,enemy);
if(nearestEnemy != null)
{
unit.Shoot(agent,deltaTime,nearestEnemy);
}
if(orders == Order.stop)
{
agent.MoveTo(agent.Avatar.transform.position,deltaTime);
return RAIN.Action.Action.ActionResult.FAILURE;
}*/
/*Transform target = unit.GetMoveTarget();
if(target != null)
{
//agent.MoveTo(agent.Avatar.transform.position,deltaTime);
//return RAIN.Action.Action.ActionResult.FAILURE;
}*/
//if(agent.MoveTo(target.position,deltaTime))
return RAIN.Action.Action.ActionResult.SUCCESS;
//return RAIN.Action.Action.ActionResult.RUNNING;
}