private void Awake() // Get the appropriate component { warriorHealth = GameObject.FindGameObjectWithTag("Warrior").GetComponent <WarriorHealth>(); alienMovement = GetComponent <AlienMovement>(); enemyAnimationTrigger = GetComponent <Animator>(); alienHealth = GetComponent <AlienHealth>(); }
private void Awake() { alienAnimation = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); particleSystem = GetComponentInChildren <ParticleSystem>(); capsuleCollider = GetComponent <CapsuleCollider>(); alienMovement = GetComponent <AlienMovement>(); instantHealth = alienInitialHealth; }
/* Initiates the Countdown for the game and finds all objects needed for the game */ public void StartGame() { // activated when play button is hit SetPageState(PageState.Countdown); theScoreManager = FindObjectOfType <ScoreManager>(); theLevel = FindObjectOfType <LevelGenerator>(); coinSpawn = FindObjectOfType <CoinGenerator>(); playmove = FindObjectOfType <PlayerMovement2>(); alienmove = FindObjectOfType <AlienMovement>(); }
public override void Update(float elapsedTime) { base.Update(elapsedTime); if (currentMovementStatus == AlienMovement.MoveRight) { if (Position.X + Width >= SpaceDefender.DisplaySetting.Width) { Position.X = SpaceDefender.DisplaySetting.Width - Width; yPositionWhenStartedMovingDownwards = Position.Y; currentMovementStatus = AlienMovement.MoveDown; previousMovementStatus = AlienMovement.MoveRight; setVector(); } } else if (currentMovementStatus == AlienMovement.MoveDown) { if (Position.Y > (yPositionWhenStartedMovingDownwards + Height)) { Position.Y = yPositionWhenStartedMovingDownwards + Height; currentMovementStatus = previousMovementStatus == AlienMovement.MoveLeft ? AlienMovement.MoveRight : AlienMovement.MoveLeft; setVector(); } } else if (currentMovementStatus == AlienMovement.MoveLeft) { if (Position.X < 0) { Position.X = 0; yPositionWhenStartedMovingDownwards = Position.Y; currentMovementStatus = AlienMovement.MoveDown; previousMovementStatus = AlienMovement.MoveLeft; setVector(); } } }
private void Awake() { anim = GetComponent <Animator>(); healthManager = GetComponent <HealthManager>(); alienMovement = GetComponent <AlienMovement>(); }