예제 #1
0
 void Start()
 {
     Trees = (TreesManager)GameObject.FindObjectOfType(typeof(TreesManager));
     if (dayNight == null)
     {
         dayNight = (DayNightCycle)GameObject.FindObjectOfType(typeof(DayNightCycle));
     }
 }
예제 #2
0
    private void getRemovedIndex(string indexremoved)
    {
        if (Trees == null)
            Trees = (TreesManager)GameObject.FindObjectOfType (typeof(TreesManager));

        if (Trees == null)
            return;

        Trees.UpdateRemovedTrees (indexremoved);
    }
예제 #3
0
    private IEnumerator Die()
    {
        for (int i = 0; i < _countResources; i++)
        {
            PoolManager.GetObject(_resource.name, transform.position, _resource.transform.rotation);
        }
        _animator.SetTrigger("Death");
        yield return(new WaitForSeconds(_animator.GetCurrentAnimatorStateInfo(0).length));

        TreesManager.SetTreeDisabled(gameObject);
    }
예제 #4
0
    public void UpdateRemovedTrees()
    {
        if (Trees == null)
            Trees = (TreesManager)GameObject.FindObjectOfType (typeof(TreesManager));

        if (Trees == null)
            return;

        if (Network.isServer && networkViewer) {
            networkViewer.RPC ("getRemovedIndex", RPCMode.Others, Trees.GetRemovedTrees ());
        }
    }
예제 #5
0
    /// <summary>
    /// Awake is called when the script instance is being loaded.
    /// </summary>
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        if (instance != this)
        {
            Destroy(gameObject);
        }

        GenerateTrees();
    }
 public void OpenMenu()
 {
     _player.SavePlayer();
     TreesManager.SaveTrees();
     SceneManager.LoadScene(0);
 }
예제 #7
0
    private void sendRemovedTreeIndex(int index)
    {
        if (Trees == null)
            Trees = (TreesManager)GameObject.FindObjectOfType (typeof(TreesManager));

        if (Trees == null)
            return;

        Trees.RemoveATrees (index);
    }
예제 #8
0
    private void resetAllTrees()
    {
        if (Trees == null)
            Trees = (TreesManager)GameObject.FindObjectOfType (typeof(TreesManager));

        if (Trees == null)
            return;

        Trees.ResetTrees ();
    }
예제 #9
0
 void Start()
 {
     networkViewer = this.GetComponent<NetworkView> ();
     Trees = (TreesManager)GameObject.FindObjectOfType (typeof(TreesManager));
 }