Ejemplo n.º 1
0
 void UpdateRoll(Vector3 V)
 {
     if (this.CheckButtonDown(this._rollButton) && V.sqrMagnitude > 0.001f)
     {
         EntityAction.ActionData freeData = this.GetFreeData();
         freeData.dir = V.normalized;
         if (this._player.DoAction("roll", freeData))
         {
             this.rollAction = this._player.GetAction("roll");
         }
     }
     else if (this.rollAction != null)
     {
         if (this.rollAction.IsReleasable() && !this.CheckButtonPressed(this._rollButton))
         {
             this.rollAction.ReleaseAction();
         }
         if (this.rollAction.IsActive)
         {
             if (V.sqrMagnitude > 0.001f)
             {
                 EntityAction.ActionData freeData2 = this.GetFreeData();
                 freeData2.dir = V.normalized;
                 this.rollAction.UpdateData(freeData2);
             }
         }
         else
         {
             this.rollAction = null;
         }
     }
 }
Ejemplo n.º 2
0
 EntityAction.ActionData GetFreeData()
 {
     if (this.savedData == null)
     {
         this.savedData = new EntityAction.ActionData();
     }
     return(this.savedData);
 }
Ejemplo n.º 3
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;
        }
    }