Пример #1
0
    public void OnTriggerEnter(Collider col)
    {
        if (col.GetComponentInParent <ShipPhysicsController>())        // If it's a ship
        {
            ShipPhysicsController ship = col.GetComponentInParent <ShipPhysicsController>();
            GetComponent <AudioSource>().Play();
            ship.GetComponentInParent <ShipSoundManager>().OnBoost();
            ship.GetComponentInChildren <Animator>().SetTrigger("Boosting");

            ParticleSystem boostEffect = ship.transform.FindChild("BoostEffect").GetComponentInChildren <ParticleSystem>();
            boostEffect.loop = false;
            boostEffect.time = 0;
            boostEffect.Play();

            ship.ApplyBoost(boost, transform.forward);
        }
    }
Пример #2
0
    void OnTriggerEnter(Collider col)
    {
        ShipPhysicsController ship   = col.GetComponentInParent <ShipPhysicsController>();
        EnemyInputController  enemy  = col.GetComponentInParent <EnemyInputController>();
        PlayerInputController player = col.GetComponentInParent <PlayerInputController>();

        if (ship)
        {
            ship.OnGoalPassed();
        }
        if (enemy)
        {
            enemy.OnGoalPassed();
        }
        if (player)
        {
            player.OnGoalPassed();
            GameObject.Find("GameFlowController").GetComponent <GameFlowController>().
            SetState(GameFlowController.State.RaceFinished);
        }
    }
Пример #3
0
 public void Start()
 {
     shipPhysicsController = GetComponent <ShipPhysicsController>();
     rb = shipPhysicsController.GetRigidbody();
     weaponController = GetComponent <WeaponController>();
 }
Пример #4
0
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <ShipPhysicsController>();
 }