コード例 #1
0
    public void AddBatter(float qt, Vector3 hitLocaltion)
    {
        // if there no pancakes with the state of mixture in the pan creat a new pancake.
        // if there are pancakes but not in the state of mixture combine them into the new pancake.
        // else add the batter to the current mixture pancake.
        if (!IsMixturePancake())                // Create new pancake
        {
            Pancake_state pancake = Instantiate(pancakePrefab, hitLocaltion, Quaternion.identity);
            pancake.GetComponent <Batter_quantity>().AddBatter(qt);
            SendPanMessage(pancake);

            // if there are already pancake in the pan combine them into the new pancake.
            // TODO: this should only be if the mixture coms into contact this a non mixture pancake.
            // TODO: Also this states should be set onto this pancake??
            for (int i = 0; i < pancakes.Count; i++)
            {
                pancakes[i].gameObject.AddComponent <Pancake_child>().SetParent(pancake.transform);
            }

            // Clear the list and add the new pancake, since it's now the only pancake in the pan.
            // and add the new pancake
            pancakes.Clear();
            pancakes.Add(pancake);
        }
        else                                                            // add mixture to pancake
        {
            pancakes[0].GetComponent <Batter_quantity>().AddBatter(qt); //there can only be 1 pancake
        }
    }
コード例 #2
0
    private void SendPanMessage(Pancake_state pancake)
    {
        IPanCollider[] panCol = pancake.GetComponents <IPanCollider>();

        foreach (IPanCollider pan in panCol)
        {
            pan.SetPanCollider(panColliderObj);
        }
    }
コード例 #3
0
 void Awake()
 {
     state = GetComponent <Pancake_state>();
 }
コード例 #4
0
 public void RemovePancake(Pancake_state pancake)
 {
     pancakes.Remove(pancake);
 }
コード例 #5
0
 public void AddPancake(Pancake_state pancake)
 {
     // TODO: if theres mixture in pan, combine.
     pancakes.Add(pancake);
 }
コード例 #6
0
 private void Awake()
 {
     pancakeState = GetComponent <Pancake_state>();
     joints       = FindChildrenWithJoints(transform).ToArray();
 }