Exemple #1
0
 void SetClimbAnimation()
 {
     //Debug.Log(this.name + " setclimb");
     Anim.SetTrigger("Climb");
     _lastTrigger    = "Climb";
     _animationState = PieceAnimationState.CLIMB;
 }
Exemple #2
0
    public void EndThrow()
    {
        if (_battleSetup)
        {
            _animTimer = ANIM_DELAY;
            enabled    = true;
            //Anim.SetTrigger("Throw");
        }
        else
        {
            if (_role == PieceRole.OFFENSE)
            {
                //SetRunAnimation();
                _animationState = PieceAnimationState.NONE;

                //Debug.Log(this.name + " EndThrow");

                /*
                 * if (CheckClimbPos() && _animationState != PieceAnimationState.CLIMB)
                 *  SetClimbAnimation();
                 * else
                 *  SetRunAnimation();
                 */
            }
            else
            {
                _animationState = PieceAnimationState.NONE;
                Anim.SetTrigger("Default");
                _lastTrigger = "Default";
            }
        }
    }
Exemple #3
0
    public bool GetHit(int hitPoints)
    {
        if (_animationState != PieceAnimationState.HIT)
        {
            Anim.SetTrigger("Hit");
            _lastTrigger    = "Hit";
            _animationState = PieceAnimationState.HIT;
        }
        //Debug.Log(this.name + " GetHit");

        bool hadFlag = false;

        _healthCalc -= hitPoints;
        if (_healthCalc <= 0)
        {
            _healthCalc = 0;
            _status     = PieceStatus.OUT;
            enabled     = true;
            _outTimer   = OUT_TIME;
            StopAnimation();
            _team.Downs++;
            _downs++;

            if (_hasFlag)
            {
                hadFlag  = true;
                _hasFlag = false;
            }
        }

        return(hadFlag);
    }
Exemple #4
0
    void PlayThrowAnimation()
    {
        Anim.SetTrigger("Throw");
        _lastTrigger    = "Throw";
        _animationState = PieceAnimationState.THROW;

        //Debug.Log(this.name + " Throw");
    }
Exemple #5
0
 void SetStandardStats()
 {
     _status           = PieceStatus.NORMAL;
     _pathIndex        = 0;
     _dir              = PieceDir.NONE;
     _moveState        = PieceMoveState.NONE;
     _hasFlag          = false;
     _coolDownTimer    = 0.0f;
     _animationState   = PieceAnimationState.NONE;
     _closestToFlag    = false;
     _downs            = 0;
     _takedowns        = 0;
     _pickups          = 0;
     _balloonsThrown   = 0;
     _distanceWithFlag = 0.0f;
 }
Exemple #6
0
 public void EndHit()
 {
     if (_role == PieceRole.OFFENSE)
     {
         _animationState = PieceAnimationState.NONE;
         if (_id == 365)
         {
             Debug.Log("finish hit animation - health = " + _health);
         }
     }
     else
     {
         _animationState = PieceAnimationState.NONE;
         Anim.SetTrigger("Default");
         _lastTrigger = "Default";
     }
 }
Exemple #7
0
 void SetRunAnimation()
 {
     Anim.SetTrigger("Run");
     _lastTrigger    = "Run";
     _animationState = PieceAnimationState.RUN;
 }
Exemple #8
0
    public void Move()
    {
        if (IsClimbing() && (_animationState == PieceAnimationState.HIT || _animationState == PieceAnimationState.THROW))
        {
            _animationState = PieceAnimationState.CLIMB;
            _lastTrigger    = "Climb";
        }

        if (_role == PieceRole.OFFENSE && (_animationState == PieceAnimationState.RUN || _animationState == PieceAnimationState.NONE || _animationState == PieceAnimationState.CLIMB))
        {
            if (_position != _destination)
            {
                if (CheckClimbPos())
                {
                    if (!IsClimbing())
                    {
                        SetClimbAnimation();
                    }
                }
                else if (!IsRunning())
                {
                    SetRunAnimation();
                }

                float xDiff = _destination.x - _position.x;
                if (xDiff < 0.0f && _dir != PieceDir.LEFT)
                {
                    transform.eulerAngles = new Vector3(0.0f, 180.0f, 0.0f);
                    _dir = PieceDir.LEFT;
                }
                else if (xDiff > 0.0f && _dir != PieceDir.RIGHT)
                {
                    transform.eulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
                    _dir = PieceDir.RIGHT;
                }
            }

            Vector2 oldPosition = _position;
            if (Utilities.CloseEnough(_position, _destination))
            {
                _position = _destination;
                SetPosition();
                _pathIndex++;
                if (_hasFlag)
                {
                    _destination = _team.GetNextHomeDestination(_position);
                }
                else
                {
                    GetNextDestination();
                }
            }
            else
            {
                Vector2 direction = ((_destination - _position).normalized) * (SPEED * _speedCalc);
                _position += direction;
                SetPosition();
            }

            if (_hasFlag)
            {
                AddToDistanceWithFlag(oldPosition, _position);
            }
        }
    }