コード例 #1
0
 public TriggerChoice(TriggerManager triggerManager)
 {
     InitializeComponent();
     CreateButton("Simple", () => Result       = triggerManager.CreateTrigger(TriggerKind.Simple));
     CreateButton("Regex", () => Result        = triggerManager.CreateTrigger(TriggerKind.Regex));
     CreateButton("Action Queue", () => Result = triggerManager.CreateTrigger(TriggerKind.ActionQueue));
     CreateButton("Skill Level", () => Result  = triggerManager.CreateTrigger(TriggerKind.SkillLevel));
 }
コード例 #2
0
ファイル: Interact.cs プロジェクト: JoelPlourde/Shore-Squad
        public override void Execute()
        {
            // Validate the arguments you've received is of the correct type.
            _interactArguments = TaskArguments as InteractArguments;

            TriggerManager.CreateTrigger(_interactArguments.Position, _interactArguments.Radius, OnTriggerEnterCondition, AtDestination);

            // Start the NavMeshAgent.
            navMeshAgent = gameObject.GetComponent <NavMeshAgent>();
            navMeshAgent.SetDestination(_interactArguments.Position);
            navMeshAgent.isStopped = false;

            actor.Animator.SetBool("Move", true);
        }
コード例 #3
0
        public override void Execute()
        {
            // Validate the arguments you've received is of the correct type.
            MoveArguments moveArguments = TaskArguments as MoveArguments;

            if (trigger == null)
            {
                // Create a trigger at destination.
                trigger = TriggerManager.CreateTrigger(moveArguments.Position, moveArguments.Radius, OnTriggerEnterCondition, OnEnd);
            }
            else
            {
                // Re-use the same trigger, simply move the position of it.
                trigger.transform.position = moveArguments.Position;
            }

            // Start the NavMeshAgent.
            actor.NavMeshAgent.SetDestination(moveArguments.Position);
            actor.NavMeshAgent.isStopped = false;

            /*
             * TODO: Take into account any previous speed modifier into consideration.
             * // Calculate the distance, it if above a threshold run, if not walk.
             * float distance = (moveArguments.Position - actor.NavMeshAgent.transform.position).magnitude;
             * Debug.Log(distance);
             * if (distance > 5f) {
             *      actor.Animator.SetInteger("Movement", 1);
             *      actor.NavMeshAgent.speed = Constant.AGENT_BASE_RUN_SPEED;
             * } else {
             *      actor.Animator.SetInteger("Movement", 0);
             *      actor.NavMeshAgent.speed = Constant.AGENT_BASE_WALK_SPEED;
             * }
             */

            actor.Animator.SetBool("Move", true);
        }