Example #1
0
    // Use this for initialization
    void Start()
    {
        //Get components
        _boatMovement = GetComponent<BoatMovement> ();
        _boatWeapons = GetComponent<BoatWeapons> ();
        _boatHealth = GetComponent<BoatHealth> ();

        //Assign controls
        _thrustButton = W_UP;
        _rotateButton = S_DOWN;
        _peanutButton = D_RIGHT;
        _torpedoButton = A_LEFT;
    }
Example #2
0
    public virtual void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "Boat") {
            if (!pickedUp) {
                pickedUp = true;

                _boatWeapons = coll.gameObject.GetComponent<BoatWeapons>();
                _boatHealth = coll.gameObject.GetComponent<BoatHealth>();
                _powerUpAudioSource.PlayOneShot(_powerUpAudioSource.clip);
                //_spriteRenderer.enabled = false;
                LeanTween.cancel(gameObject);
                LeanTween.scale (gameObject, Vector3.zero, .2f);

                Destroy(gameObject, _powerUpAudioSource.clip.length);
            }
        }
    }