private void Awake()
    {
        layerMask = ~layerMask;

        //Sets the instance equal to the object this script is attached to (will auto-delete
        // itself if one already exists)
        if (SharedInstance == null)
        {
            SharedInstance = this;
        }
        else
        {
            Debug.LogWarning("Duplicate MissleLauncher detected! Destroying extra copy...");
            Destroy(gameObject);
        }

        //Gets launchers Rigidbody
        rb = GetComponent <Rigidbody>();

        //Gets launchers LineRenderer
        lr         = GetComponent <LineRenderer>();
        lr.enabled = false;

        timer = rocketCooldown;

        //Makes sure there is no way for hasFired to start true (it will crash the game if it
        // starts true)
        if (hasFired == true)
        {
            hasFired = false;
        }
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     // set current to a random point
     current        = Random.Range(0, points.Length);
     body           = GetComponent <Rigidbody2D>();
     animator       = GetComponent <Animator>();
     missleLauncher = barrel.GetComponent <MissleLauncher>();
 }