Beispiel #1
0
    public void instantiateThought(GameObject thoughtPrefab, verletter.JellyColor color)
    {
        Vector3    velocity = new Vector3(12, 11);
        GameObject thought  = Instantiate(thoughtPrefab, thoughtsContainer);
        verletter  jelly    = thought.GetComponent <verletter>();

        if (jelly == null)
        {
            Destroy(thought);
            throw new System.Exception("failed to instanciate thought because prefab didn't have a verletter component, prefab: " + thoughtPrefab.ToString());
        }

        jelly.color = color;

        Vector3 offset = firemanBrain.position - jelly.centerPoint.position;

        offset.z = 0;
        foreach (Rigidbody rb in jelly.GetComponentsInChildren <Rigidbody>())
        {
            rb.position += offset;
            rb.velocity  = velocity;
        }
    }
Beispiel #2
0
 public void removeJelly(verletter jelly)
 {
     jelliesByColor[jelly.color].Remove(jelly);
 }
Beispiel #3
0
 public void addJelly(verletter jelly)
 {
     jelliesByColor[jelly.color].Add(jelly);
 }