Beispiel #1
0
    void checkForGameStarterCheckpoint()
    {
        bool found = false;

        if (checkpointScripts.Count > 0)
        {
            foreach (object chObj in checkpointScripts)
            {
                CheckPointUpdate ch = (CheckPointUpdate)chObj;

                if (ch.gameStarterCheckpoint)
                {
                    if (!found)
                    {
                        ch.gameObject.SendMessage("c_manualCheckPointActivation");

                        if (player != null)
                        {
                            respawnPoint.transform.position = ch.respawnTransform.position;
                            player.transform.position       = respawnPoint.transform.position;
                        }
                        else
                        {
                            Debug.Log("ATTENZIONE - player NULL in checkPointHandler");
                        }
                        found = true;
                    }
                    else
                    {
                        Debug.Log("ATTENZIONE - più checkpoint sono settati come gameStarterPoint");
                    }
                }
            }
        }
    }
Beispiel #2
0
    public void c_setActiveLamp(CheckPointUpdate _checkpointScript)
    {
        //check if it exists
        //Debug.Log ("set active lamp");
        bool found = false;

        foreach (object chObj in checkpointScripts)
        {
            CheckPointUpdate ch = (CheckPointUpdate)chObj;

            if (ch == _checkpointScript)
            {
                found = true;
                //Debug.Log("found");
                break;
            }
        }

        if (!found)
        {
            Debug.Log("NOT found");
            checkpointScripts.Add(_checkpointScript);
            checkpointObjs.Add(_checkpointScript.gameObject);
        }

        foreach (object chObj in checkpointScripts)
        {
            CheckPointUpdate ch = (CheckPointUpdate)chObj;

            if (ch != _checkpointScript)
            {
                if (ch.Activated)
                {
                    ch.gameObject.GetComponent <streetLampAnimation>().c_deactivateLight();
                    ch.gameObject.GetComponent <CheckPointUpdate>().c_setInactiveLight();
                    //Debug.Log("chiamo deactivate su " + ch.gameObject.name);
                }
            }
        }
    }