예제 #1
0
 void DesactivateChaseArea()
 {
     foreach (GameObject GO in enemies)
     {
         if (GO.CompareTag("EnemyUndead"))
         {
             UndeadController undead = GO.GetComponent <UndeadController>();
             undead.chasing = false;
         }
         else if (GO.CompareTag("EnemyRange"))
         {
             ShooterController range = GO.GetComponent <ShooterController>();
             range.chasing = false;
         }
     }
     enemies.Clear();
     isCreated = false;
 }
예제 #2
0
 public bool CompareTags(string tag) => GO.CompareTag(tag);
예제 #3
0
 public bool CompareTags(string tag)
 {
     return(GO.CompareTag(tag));
 }
예제 #4
0
    private void ShowKitchenComponent(KitchenComponent component)
    {
        foreach (ComponentObject def in componentObjectDefinitions)
        {
            // this was a last minute addition when I realized sometimes more than one thing needs to be toggled on:
            // example: both "Add Knobs" and "Add Pulls" also need the row of metal options available
            if (def.additionalGameObjects.Length > 0)
            {
                foreach (GameObject GO in def.additionalGameObjects)
                {
                    GO.transform.parent.gameObject.SetActive(true);
                    GO.SetActive(true);
                    if (GO.CompareTag("Knobs"))
                    {
                        // set the toggle by whether or not the knobs are visible on this gameObject
                        if (camScript == null)
                        {
                            camScript = Camera.main.GetComponent <CameraController>();
                        }

                        GameObject currentGO = camScript.selectedObj.gameObject;
                        if (currentGO != null)
                        {
                            for (int i = 0; i < currentGO.transform.childCount; i++)
                            {
                                if (currentGO.transform.GetChild(i).gameObject.CompareTag("Knobs"))
                                {
                                    bool   active = currentGO.transform.GetChild(i).gameObject.activeInHierarchy;
                                    Toggle toggle = GO.GetComponent <Toggle>();
                                    if (toggle != null)
                                    {
                                        toggle.isOn = active;
                                    }
                                }
                            }
                        }
                    }
                    if (GO.CompareTag("Pulls"))
                    {
                        // set the toggle by whether or not the knobs are visible on this gameObject
                        if (camScript == null)
                        {
                            camScript = Camera.main.GetComponent <CameraController>();
                        }

                        GameObject currentGO = camScript.selectedObj.gameObject;
                        if (currentGO != null)
                        {
                            for (int i = 0; i < currentGO.transform.childCount; i++)
                            {
                                if (currentGO.transform.GetChild(i).gameObject.CompareTag("Pulls"))
                                {
                                    bool   active = currentGO.transform.GetChild(i).gameObject.activeInHierarchy;
                                    Toggle toggle = GO.GetComponent <Toggle>();
                                    if (toggle != null)
                                    {
                                        toggle.isOn = active;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (component == def.component)
            {
                def.gameObject.transform.parent.gameObject.SetActive(true);
                def.gameObject.SetActive(true);
                if (def.gameObject.CompareTag("Knobs"))
                {
                    // set the toggle by whether or not the knobs are visible on this gameObject
                    if (camScript == null)
                    {
                        camScript = Camera.main.GetComponent <CameraController>();
                    }

                    GameObject currentGO = camScript.selectedObj.gameObject;
                    if (currentGO != null)
                    {
                        for (int i = 0; i < currentGO.transform.childCount; i++)
                        {
                            if (currentGO.transform.GetChild(i).gameObject.CompareTag("Knobs"))
                            {
                                bool   active = currentGO.transform.GetChild(i).gameObject.activeInHierarchy;
                                Toggle toggle = def.gameObject.GetComponent <Toggle>();
                                if (toggle != null)
                                {
                                    toggle.isOn = active;
                                }
                            }
                        }
                    }
                }
                if (def.gameObject.CompareTag("Pulls"))
                {
                    // set the toggle by whether or not the knobs are visible on this gameObject
                    if (camScript == null)
                    {
                        camScript = Camera.main.GetComponent <CameraController>();
                    }

                    GameObject currentGO = camScript.selectedObj.gameObject;
                    if (currentGO != null)
                    {
                        for (int i = 0; i < currentGO.transform.childCount; i++)
                        {
                            if (currentGO.transform.GetChild(i).gameObject.CompareTag("Pulls"))
                            {
                                bool   active = currentGO.transform.GetChild(i).gameObject.activeInHierarchy;
                                Toggle toggle = def.gameObject.GetComponent <Toggle>();
                                if (toggle != null)
                                {
                                    toggle.isOn = active;
                                }
                            }
                        }
                    }
                }
            }
        }
    }