/// <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); }
/// <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)); }
/// <summary> /// Starts move counter and gets reference to resourceData. /// </summary> public void OnStart() { _nextMoveTimer.Start(); _resourceData = UnityScene.GetResourceManager().resourceData as Snake2DResourceData; }