Ejemplo n.º 1
0
    public GreenController newObject(Vector3 pos, Quaternion rot)
    {
        GreenController t = null;

        if (inactive.Count > 0)
        {
            Debug.Log("inactive.Count() " + inactive.Count + " > 0");
            t = inactive[0];
            inactive.RemoveAt(0);
            active.Add(t);
        }
        else if (createdObjects() < maxObjects)
        {
            Debug.Log("createdObjects() " + createdObjects() + " < maxObjects " + maxObjects);
            t = Instantiate <GreenController>(prefab, pos, rot);
            t.transform.parent = this.transform;
            active.Add(t);
        }
        if (t == null)
        {
            throw new System.Exception("Error! Spawned more than the max (" + maxObjects + ") number of bullets.");
        }
        t.gameObject.SetActive(true);
        t.transform.position = pos;
        t.transform.rotation = rot;
        return(t);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Call this method to initialize this laser instance.
 /// </summary>
 /// <param name="caller">Caller instance</param>
 /// <param name="shooter">Shooter type</param>
 public void Init(GreenController caller, CharacterType shooter)
 {
     // Failed safe check
     if (caller.GetType() != typeof(GreenController))
     {
         return;
     }
     _shooter = shooter;
     _isHit   = false;
 }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(gameObject);

        if (instance == null)
        {
            instance = this;
        }
        else
        {
            if (instance != this)
            {
                Destroy(gameObject);
            }
        }
    }
Ejemplo n.º 4
0
 private void RefreshShownColor()
 {
     GreenController.SetBrightness(Color.G / 255f * Brightness);
     RedController.SetBrightness(Color.R / 255f * Brightness);
     BlueController.SetBrightness(Color.B / 255f * Brightness);
 }
Ejemplo n.º 5
0
 public void destroyObject(GreenController t)
 {
     t.gameObject.SetActive(false);
     inactive.Add(t);
     active.Remove(t);
 }