예제 #1
0
        /// <summary>
        /// Instantiate new part of tail and attaches it to snake tail parts.
        /// </summary>
        public void GrowSnake()
        {
            var        resourceData = UnityScene.GetResourceManager().resourceData as Snake2DResourceData;
            GameObject newSnakeTile = MonoBehaviour.Instantiate(resourceData.PREFAB_SNAKE_TILE);

            newSnakeTile.transform.position = head.transform.position;
            tailParts.Insert(0, newSnakeTile);
        }
예제 #2
0
        /// <summary>
        /// Factory method. Instantiates normal food prefab.
        /// </summary>
        protected override GameObject MakeGameObject()
        {
            var resourceData = UnityScene.GetResourceManager().resourceData as Snake2DResourceData;

            return(MonoBehaviour.Instantiate(resourceData.PREFAB_NORMAL_FEED));
        }
예제 #3
0
 /// <summary>
 /// Starts move counter and gets reference to resourceData.
 /// </summary>
 public void OnStart()
 {
     _nextMoveTimer.Start();
     _resourceData = UnityScene.GetResourceManager().resourceData as Snake2DResourceData;
 }