Пример #1
0
 void IPauseListener.PauseChanged(bool pause)
 {
     if (pause && this._player != null)
     {
         this._player.StopMoving();
         for (int i = this.releaseActions.Count - 1; i >= 0; i--)
         {
             PlayerController.RelaseAction relaseAction = this.releaseActions[i];
             this._player.ReleaseAction(relaseAction.action);
             this.releaseActions.RemoveAt(i);
         }
     }
 }
Пример #2
0
    void IUpdatable.UpdateObject()
    {
        if (this._player == null)
        {
            return;
        }
        if (this._player.InactiveOrDead)
        {
            this.ReleaseEntity(this._player);
            return;
        }
        EventListener.PlayerUpdate();         // Invoke custom event
        Vector3 zero = Vector3.zero;
        Vector2 vector;

        if (this.GetMoveDir(out vector))
        {
            // Decomp fix
            zero = new Vector3(vector.x, 0, vector.y);

            /*
             * zero..ctor(vector.x, 0f, vector.y);
             */
            if (vector.magnitude < 0.0625f)
            {
                zero.Normalize();
                if (this.rollAction == null || !this.rollAction.IsActive)
                {
                    this._player.TurnTo(zero, 1080f);
                }
                if (this.isMoving)
                {
                    this.isMoving = false;
                    this._player.StopMoving();
                }
            }
            else
            {
                bool flag = this.isMoving;
                this.isMoving = this._player.SetMoveDirection(zero, true);
                this.UpdateRoll(zero);
                if (!flag || !PlayerController.IsRectilinear(zero) || Vector3.Dot(zero, this.lastDir) < 0.7f)
                {
                    this.lastDir = zero;
                }
                else
                {
                    this.lastDir = Vector3.RotateTowards(this.lastDir, zero, 12.566371f * Time.deltaTime, 10f * Time.deltaTime);
                }
            }
        }
        else
        {
            this.UpdateRoll(Vector3.zero);
            bool flag2 = this.isMoving;
            this.isMoving = false;
            if (flag2)
            {
                this._player.TurnTo(this.lastDir, 0f);
                this._player.StopMoving();
            }
        }
        for (int i = this.releaseActions.Count - 1; i >= 0; i--)
        {
            PlayerController.RelaseAction relaseAction = this.releaseActions[i];
            if (!this.CheckButtonPressed(relaseAction.button))
            {
                this._player.ReleaseAction(relaseAction.action);
                this.releaseActions.RemoveAt(i);
            }
        }
        for (int j = 0; j < this._attacks.Length; j++)
        {
            if (this.CheckButtonDown(this._attacks[j].button))
            {
                EntityAction.ActionData freeData = this.GetFreeData();
                freeData.dir = zero;
                AttackAction attack = this._player.GetAttack(this._attacks[j].attackName);
                if (attack != null && this._player.Attack(this._attacks[j].attackName, freeData) && attack.IsReleasable())
                {
                    this.releaseActions.Add(new PlayerController.RelaseAction(attack, this._attacks[j].button));
                }
            }
        }
        for (int k = this.btnSignals.Count - 1; k >= 0; k--)
        {
            PlayerController.BtnState value = this.btnSignals[k];
            value.down         = false;
            this.btnSignals[k] = value;
        }
    }