コード例 #1
0
 protected virtual void Update()
 {
     if (imMoving)
     {
         if (poweredFrameCount++ == shutdownFrames)
         {
             rgbd.constraints = RigidbodyConstraints2D.FreezePositionX;
             sceneAnimator.SetBool("Moving", false, gameObject);
             imMoving = false;
         }
     }
 }
コード例 #2
0
    public virtual void StopMoving()
    {
        canMove     = false;
        isAttacking = false;

        if (sceneAnimator)
        {
            sceneAnimator.SetFloat("Speed", 0, this.gameObject);
            sceneAnimator.SetBool("IsGrounded", true, this.gameObject);
            sceneAnimator.SetBool("Attacking", false, this.gameObject);
        }
    }
コード例 #3
0
    public void TogglePowerableAnimatorsWithName(string animatorParameter, bool value, string name)
    {
        GameObject    gameObject    = GameObject.Find(name);
        SceneAnimator sceneAnimator = FindObjectOfType <SceneAnimator>();

        sceneAnimator.SetBool(animatorParameter, value, gameObject);
    }
コード例 #4
0
 protected void ChangeLavaSpritesIntoWater(bool isWater)
 {
     GameObject[] changableLavas = GameObject.FindGameObjectsWithTag("ChangableLava" + id);
     foreach (GameObject changableLava in changableLavas)
     {
         SceneAnimator sAnimator = FindObjectOfType <SceneAnimator>();
         sAnimator.SetBool("isWater", isWater, changableLava);
     }
 }
コード例 #5
0
    public void Fall()
    {
        PolygonCollider2D collider = GetComponent <PolygonCollider2D>();

        collider.enabled = true;
        Debug.Log("Got Collider and activated it");

        SceneAnimator sceneAnimator = GameObject.FindObjectOfType <SceneAnimator>();

        sceneAnimator.SetBool("RockBottom", true, this.gameObject);
        Debug.Log("Got Sceneanimator and animated " + gameObject.name);
    }
コード例 #6
0
    public void PowerableToggleLavaIntoWater(string parameter, bool value, int damagingId)
    {
        LavaIntoWaterIdentifier[] lavas         = FindObjectsOfType <LavaIntoWaterIdentifier>();
        SceneAnimator             sceneAnimator = FindObjectOfType <SceneAnimator>();

        foreach (LavaIntoWaterIdentifier lava in lavas)
        {
            if (lava.id == damagingId)
            {
                sceneAnimator.SetBool(parameter, value, lava.gameObject);
            }
        }
    }
コード例 #7
0
    public void ChangeLavaIntoWater(bool boolValue)
    {
        LavaIntoWaterIdentifier[] changeableLavas = FindObjectsOfType <LavaIntoWaterIdentifier>();

        foreach (LavaIntoWaterIdentifier lava in changeableLavas)
        {
            if (id == lava.id)
            {
                SceneAnimator sAnimator = FindObjectOfType <SceneAnimator>();
                sAnimator.SetBool("WaterFalling", boolValue, lava.gameObject);
                StartCoroutine(WaitForLavaAnimator());
            }
        }

        if (boolValue)
        {
            turnedIntoWater = true;
        }
        else if (boolValue == false)
        {
            turnedIntoWater = false;
        }
    }
コード例 #8
0
    public void StartAnimatorBool(string parameter, bool value, GameObject gameObject)
    {
        SceneAnimator sceneAnimator = FindObjectOfType <SceneAnimator>();

        sceneAnimator.SetBool(parameter, value, gameObject);
    }
コード例 #9
0
    protected void Move()
    {
        isGrounded = IsItGrounded();

        if (IsJumping(isGrounded))
        {
            justJumped = true;
            if (localPlayer)
            {
                SoundManager sManager = FindObjectOfType <SoundManager>();
                sManager.PlaySound(gameObject, GameSounds.PlayerJump, false);
            }
            speedY = maxYSpeed * directionY;
            StartCoroutine(WaitJumping());
        }
        else
        {
            speedY = rb2d.velocity.y;
        }

        if (IsGoingRight())
        {
            // Si estaba yendo a la izquierda resetea la aceleración
            if (directionX == -1)
            {
                ResetDirectionX(1);
            }

            // sino acelera
            else if (acceleration < maxAcceleration)
            {
                Accelerate();
            }

            actualSpeed = maxXSpeed * acceleration;
            speedX      = actualSpeed;
        }
        else if (IsGoingLeft())
        {
            // Si estaba yendo a la derecha resetea la aceleración
            if (directionX == 1)
            {
                ResetDirectionX(-1);
            }

            // sino acelera
            else if (acceleration < maxAcceleration)
            {
                Accelerate();
            }

            actualSpeed = maxXSpeed * acceleration;
            speedX      = -actualSpeed;
        }
        else
        {
            speedX       = 0f;
            acceleration = 0;
        }

        if (lastPosition != transform.position)
        {
            if (sceneAnimator)
            {
                sceneAnimator.SetFloat("Speed", Mathf.Abs(rb2d.velocity.x), this.gameObject);
                sceneAnimator.SetBool("IsGrounded", isGrounded, this.gameObject);
            }
        }

        rb2d.velocity = new Vector2(speedX, speedY);
        lastPosition  = transform.position;
    }
コード例 #10
0
    protected void SetAnimatorBool(string parameter, bool value, ActivableSystem activableSystem, float time)
    {
        SceneAnimator sceneAnimator = GameObject.FindObjectOfType <SceneAnimator>();

        sceneAnimator.SetBool(parameter, value, activableSystem.gameObject, time);
    }
コード例 #11
0
    public void Slide()
    {
        SceneAnimator sceneAnimator = GameObject.FindObjectOfType <SceneAnimator>();

        sceneAnimator.SetBool("caidaOn", true, this.gameObject);
    }