コード例 #1
0
    /// <summary>
    /// Starts a timer for when the object is gonna transition to <see cref="AlphaObserveState"/> and handles conditions for state swapping.
    /// </summary>
    public override void Update()
    {
        //ApplyFlockBehaviour();
        newPathTimer += Time.deltaTime;
        Destination   = AIagent.destination;
        base.Update();
        setVelocity();

        if (PlayerHasFire)
        {
            owner.TransitionTo <AlphaFleeState>();
        }
        else if (!PreyLocated)
        {
            ChaseSprite.SetActive(false);
            owner.TransitionTo <AlphaPatrolState>();
        }
        else if (newPathTimer > 0.35 && CheckRemainingDistance(Prey.transform.position, 8f) && CanSeePrey())
        {
            // owner.TransitionTo<WolfAttackPatrolState>();
            owner.TransitionTo <AlphaObserveState>();
        }
        else if (newPathTimer > 0.35)
        {
            if (CanSeePrey())
            {
                AIagent.SetDestination(Prey.transform.position);
            }
            newPathTimer = 0;
        }
    }
コード例 #2
0
 /// <summary>
 /// Sets values upon initialization
 /// </summary>
 /// <param name="owner"></param>
 public override void Initialize(StateMachine owner)
 {
     this.owner = (GiantSM)owner;
     OwnerPhysics.SetAirResistance(0.95f);
     PatrolSprite.SetActive(false);
     AttackSprite.SetActive(false);
     ChaseSprite.SetActive(false);
     //patrolPointCenter = owner.transform.GetComponentInParent<Transform>().transform.position; //giants kommer ha en parent som är mitten av dess patrolpoint
 }
コード例 #3
0
 /// <summary>
 /// Disables sprite upon exit.
 /// </summary>
 public override void Exit()
 {
     ChaseSprite.SetActive(false);
 }
コード例 #4
0
ファイル: GiantChaseState.cs プロジェクト: Flargy/Portfolio
 /// <summary>
 /// Increases movement speed upon entry
 /// </summary>
 public override void Enter()
 {
     AIagent.speed = MovementSpeed * 2.5f;
     ChaseSprite.SetActive(true);
 }
コード例 #5
0
 /// <summary>
 /// Sets values upon entry.
 /// </summary>
 public override void Enter()
 {
     ChaseSprite.SetActive(true);
     newPathTimer  = 0;
     AIagent.speed = MoveSpeed * 2.2f;
 }