// Start is called before the first frame update void Start() { rd = GetComponent <Rigidbody2D>(); rd.velocity = new Vector2(-1, 0); assa = GetComponent <AdvancedSpriteSheetAnimation>(); assa.Activate("existing"); }
// Start is called before the first frame update void Start() { firstTime = true; animeControler = GetComponent <AdvancedSpriteSheetAnimation>(); animeControler.Activate("GBThrow"); whichAnimationIsRunning = AnimationMode.Shoot; }
// Update is called once per frame void Update() { float speedX = Input.GetAxis("Horizontal"); float gravity = Input.GetAxis("Vertical"); if (gravity != 0) { if (gravity > 0) { sr.flipY = true; rd.gravityScale = -1; } else { sr.flipY = false; rd.gravityScale = 1; } } if (speedX != 0) { if (speedX > 0) { sr.flipX = true; } else { sr.flipX = false; } rd.velocity = new Vector2(speedX * TrueSpeed, rd.velocity.y); if (whichAnimationIsRunning != AnimationMode.Walk) { animeControler.Activate("GBWalk"); whichAnimationIsRunning = AnimationMode.Walk; } } else { if (whichAnimationIsRunning != AnimationMode.Stand) { animeControler.Activate("GBStand"); whichAnimationIsRunning = AnimationMode.Stand; } } }
// Update is called once per frame void Update() { if (!animeControler.Active && firstTime) { GameObject shot = Instantiate(toClone); shot.transform.position = new Vector2(transform.position.x + (sr.flipX == true ? -1 : 1) * bulletSpeed, transform.position.y); shot.AddComponent <HandleShots>(); animeControler.Activate("GBStand"); firstTime = false; Destroy(gameObject.GetComponent <ShootGB>()); } }