Example #1
0
    private void Start()
    {
        GameObject sceneMenager = GameObject.FindWithTag("SceneMenager");

        if (SceneManager.GetActiveScene().buildIndex == 0)                              //MainMenu
        {
            MainMenu_SM Events = sceneMenager.GetComponent <MainMenu_SM>();
            Events.OnColorChange += Events_OnColorChange;
        }
        else if (SceneManager.GetActiveScene().buildIndex == 4)                          //MissionScene
        {
            Bulid_Script Events = sceneMenager.GetComponent <Bulid_Script>();
            Events.OnColorChange += Events_OnColorChange;
        }
        Transform par = null;

        if (transform.parent != null)
        {
            par = transform.parent;
        }
        else
        {
            par = transform;
        }

        DetectAllChildren(par, targets);
        if (PlayerPrefs.HasKey("ColorId"))
        {
            Events_OnColorChange(PlayerPrefs.GetInt("ColorId"));
        }
    }
Example #2
0
    private void Start()
    {
        GameObject sceneMenager = GameObject.FindWithTag("SceneMenager");

        bs          = sceneMenager.GetComponent <Bulid_Script>();
        seeker      = GetComponent <Seeker>();
        rb          = GetComponent <Rigidbody2D>();
        startingPos = transform.position;
        target      = startingPos;
        maxLife     = Life;
        InvokeRepeating("UpdatePath", 0.1f, 0.3f);
    }