IsGroundedWithTimeout() публичный Метод

public IsGroundedWithTimeout ( ) : bool
Результат bool
Пример #1
0
    public virtual void Update()
    {
        ThirdPersonController playerController = (ThirdPersonController)this.GetComponent(typeof(ThirdPersonController));
        float currentSpeed = playerController.GetSpeed();

        if (currentSpeed > playerController.walkSpeed)
        {
            this.anim.CrossFade("run");
            this.anim.Blend("jumpland", 0);
        }
        else
        {
            if (currentSpeed > 0.1f)
            {
                this.anim.CrossFade("walk");
                this.anim.Blend("jumpland", 0);
            }
            else
            {
                this.anim.Blend("walk", 0f, 0.3f);
                this.anim.Blend("run", 0f, 0.3f);
                this.anim.Blend("run", 0f, 0.3f);
            }
        }
        this.anim["run"].normalizedSpeed  = this.runSpeedScale;
        this.anim["walk"].normalizedSpeed = this.walkSpeedScale;
        if (playerController.IsJumping())
        {
            if (playerController.IsControlledDescent())
            {
                this.anim.CrossFade("jetpackjump", 0.2f);
            }
            else
            {
                if (playerController.HasJumpReachedApex())
                {
                    this.anim.CrossFade("jumpfall", 0.2f);
                }
                else
                {
                    this.anim.CrossFade("jump", 0.2f);
                }
            }
        }
        else
        {
            if (!playerController.IsGroundedWithTimeout())
            {
                this.anim.CrossFade("ledgefall", 0.2f);
            }
            else
            {
                this.anim.Blend("ledgefall", 0f, 0.2f);
            }
        }
    }
    public virtual void Update()
    {
        ThirdPersonController controller = (ThirdPersonController)this.GetComponent(typeof(ThirdPersonController));

        if (((!this.busy && Input.GetButtonDown("Fire1")) && controller.IsGroundedWithTimeout()) && !controller.IsMoving())
        {
            this.SendMessage("DidPunch");
            this.busy = true;
        }
    }
    void Update()
    {
        ThirdPersonController marioController = GetComponent <ThirdPersonController> ();
        float currentSpeed = marioController.GetSpeed();

        networkSyncAnimation = GetComponent <NetworkSyncAnimation> ();

        // Fade in run
        if (currentSpeed > marioController.walkSpeed)
        {
            animation.CrossFade("run");
            // We fade out jumpland quick otherwise we get sliding feet
            animation.Blend("jumpland", 0);
            networkSyncAnimation.SendMessage("SyncAnimation", "run");
            // Fade in walk
        }
        else if (currentSpeed > 0.1f)
        {
            animation.CrossFade("walk");
            // We fade out jumpland realy quick otherwise we get sliding feet
            animation.Blend("jumpland", 0);
            networkSyncAnimation.SendMessage("SyncAnimation", "walk");
            // Fade out walk and run
        }
        else
        {
            animation.CrossFade("idle");
            networkSyncAnimation.SendMessage("SyncAnimation", "idle");
        }

        animation["run"].normalizedSpeed  = runSpeedScale;
        animation["walk"].normalizedSpeed = walkSpeedScale;

        if (marioController.IsJumping())
        {
            if (marioController.IsCapeFlying())
            {
                animation.CrossFade("jetpackjump", 0.2f);
                networkSyncAnimation.SendMessage("SyncAnimation", "jetpackjump");
            }
            else if (marioController.HasJumpReachedApex())
            {
                animation.CrossFade("jumpfall", 0.2f);
                networkSyncAnimation.SendMessage("SyncAnimation", "jumpfall");
            }
            else
            {
                animation.CrossFade("jump", 0.2f);
                networkSyncAnimation.SendMessage("SyncAnimation", "jump");
            }
            // We fell down somewhere
        }
        else if (!marioController.IsGroundedWithTimeout())
        {
            animation.CrossFade("ledgefall", 0.2f);
            networkSyncAnimation.SendMessage("SyncAnimation", "ledgefall");
            // We are not falling down anymore
        }
        else
        {
            animation.Blend("ledgefall", 0.0f, 0.2f);
        }
    }