protected virtual void Update() { if (imMoving) { if (poweredFrameCount++ == shutdownFrames) { rgbd.constraints = RigidbodyConstraints2D.FreezePositionX; sceneAnimator.SetBool("Moving", false, gameObject); imMoving = false; } } }
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); } }
public void TogglePowerableAnimatorsWithName(string animatorParameter, bool value, string name) { GameObject gameObject = GameObject.Find(name); SceneAnimator sceneAnimator = FindObjectOfType <SceneAnimator>(); sceneAnimator.SetBool(animatorParameter, value, gameObject); }
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); } }
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); }
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); } } }
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; } }
public void StartAnimatorBool(string parameter, bool value, GameObject gameObject) { SceneAnimator sceneAnimator = FindObjectOfType <SceneAnimator>(); sceneAnimator.SetBool(parameter, value, gameObject); }
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; }
protected void SetAnimatorBool(string parameter, bool value, ActivableSystem activableSystem, float time) { SceneAnimator sceneAnimator = GameObject.FindObjectOfType <SceneAnimator>(); sceneAnimator.SetBool(parameter, value, activableSystem.gameObject, time); }
public void Slide() { SceneAnimator sceneAnimator = GameObject.FindObjectOfType <SceneAnimator>(); sceneAnimator.SetBool("caidaOn", true, this.gameObject); }