public void CheckForPowerUp(ColliderCommon ballColliderCommon, ColliderCommon carColliderCommon, Transform ballPosition, Transform ball) { if ((ballColliderCommon.PowerUpTaken || carColliderCommon.PowerUpTaken) && !isPowerActive) { // Behaviours can be increased in future and if it is increase enum can be used instead of string if (ballColliderCommon.PowerUpName == "CircleBallPower" || carColliderCommon.PowerUpName == "CircleBallPower") { powerUpBehaviours = new CircleBallPowerUp(ball, this.transform, ballPosition); isPowerActive = true; } } if (isPowerActive) { powerUpBehaviours.PowerUp(); if ((ballColliderCommon.PowerUpFinished || carColliderCommon.PowerUpFinished)) { powerUpBehaviours.FinishBehaviour(); powerUpBehaviours = null; ballColliderCommon.PowerUpFinished = false; carColliderCommon.PowerUpFinished = false; isPowerActive = false; ball.GetComponent <BallManager>().enabled = true; } } }
private void Awake() { powerUpSpawnManager = GameObject.FindGameObjectWithTag("PowerUpSpawnManager").GetComponent <PowerUpSpawnManager>(); colliderCommonBall = GameObject.FindGameObjectWithTag("Ball").GetComponent <ColliderCommon>(); colliderCommonCar = GameObject.FindGameObjectWithTag("Car").GetComponent <ColliderCommon>(); powerUpTaken = false; }
private void Awake() { colliderCommon = GetComponent <ColliderCommon>(); if (isThisAIBall) { enemyTag = "Car"; } else { enemyTag = "AICar"; } }
private void Start() { movement = GetComponent <CarMovement>(); driftLine = GetComponent <CarDriftLine>(); carDriftDust = GetComponent <CarDriftDust>(); carColliderCommon = GetComponent <ColliderCommon>(); ballColliderCommon = ball.GetComponent <ColliderCommon>(); carPowerUpControl = GetComponent <CarPowerUpControl>(); InitializeTempDistance(); aIState = AIStates.None; FindAllCarsExceptThis(); }
private void Awake() { movement = GetComponent <CarMovement>(); driftLine = GetComponent <CarDriftLine>(); carColliderCommon = GetComponent <ColliderCommon>(); ball = GameObject.FindGameObjectWithTag("Ball").transform; ballPosition = GameObject.FindGameObjectWithTag("BallPosition").transform; ballColliderCommon = ball.GetComponent <ColliderCommon>(); carDriftDust = GetComponent <CarDriftDust>(); animator = GetComponent <Animator>(); carPowerUpControl = GetComponent <CarPowerUpControl>(); carDirection = CarDirection.None; isAlive = true; }
private void Awake() { colliderCommon = GetComponent <ColliderCommon>(); }