Ejemplo n.º 1
0
        public static IEnumerator EndSpawn(GameObject newGameObject, float duration)
        {
            // wait
            yield return(new WaitForSecondsRealtime(duration));

            // spawn the object
            Animator animator = newGameObject.GetComponent <Animator>();

            if (animator)
            {
                animator.SetTrigger("spawn");
            }

            // if we are dealing with the player, prepare the object
            GridPlayer2D gridPlayer2D = newGameObject.GetComponent <GridPlayer2D>() as GridPlayer2D;

            if (gridPlayer2D)
            {
                Actor character = newGameObject.GetComponent <Actor>() as Actor;
                if (character)
                {
                    character.control.Setup();
                }
            }
        }
Ejemplo n.º 2
0
        public override void Setup()
        {
            base.Setup();

            playerObject = GameObject.FindGameObjectWithTag("Player");

            Actor actor = playerObject.GetComponent <Actor>();

            actor.Init();

            if (gridPlayer2D == null)
            {
                gridPlayer2D       = playerObject.GetComponent <GridPlayer2D>();
                gridPlayer2D.speed = playerObject.GetComponent <Actor>().GetStat("SPD");
            }

            ProximityCtrl.Instance.Init();
            ProximityCtrl.Instance.UpdateProximity(playerObject.transform.position);
        }