Beispiel #1
0
    protected virtual void FixedUpdate()
    {
        if ((isSelected) && (!inCombat))
        {
            if (rb.velocity != Vector3.zero)
            {
                unitAnimation.AnimMove(true);
            }
            else
            {
                unitAnimation.AnimMove(false);
            }

            Movement();

            //Activate combat when enemy is near the range of the Unit's weapon.
            if ((SeeEnemy()) && (!inCombatDelay) && (!drivebyUsed))
            {
                StartCombat();
            }
        }

        //Delay when an combat enounter had taken place and was ignored or attacked.
        if (inCombatDelay)
        {
            inComatDelayTimer -= Time.deltaTime;
            if (inComatDelayTimer < 0)
            {
                inCombatDelay = false;
            }
        }
    }