public GameObject InstantiateTile(Vector3 position, string tileID, int x = 0, int y = 0) { GameObject newTile = null; if (TileMap.ContainsKey(tileID) && TileMap [tileID].prefab != "") { GameObject prefab = Resources.Load <GameObject> (TileMap [tileID].prefab); if (prefab != null) { position.z = (float)TileMap [tileID].layer; position.z += prefab.transform.position.z; newTile = Instantiate(prefab, position, Quaternion.identity) as GameObject; newTile.name = tileID; newTile.transform.parent = _levelParent.transform; if (TileMap [tileID].isPlayer) { _player = newTile.GetComponent <SMBPlayer> (); } if (TileMap [tileID].isLevelEnd) { InstantiateEndPoleBar(position, x, y); } if (newTile.tag != "Untagged") { _gameObjecs.Add(newTile); } } } return(newTile); }
private void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <SMBPlayer>(); beliefArray = new string[4]; updateBeliefArray(); }
override protected void DestroyBlock(SMBPlayer player) { if (player.State == SMBConstants.PlayerState.GrownUp) { SMBGameWorld.Instance.PlayParticle(transform.position, "SMBBlockParticleSystem"); SMBGameWorld.Instance.PlaySoundEffect((int)SMBConstants.GameWorldSoundEffects.BreakBlock); Destroy(gameObject); } }
void OnInteraction(SMBPlayer player) { if (_bounceState == BounceState.None && !_isDestroyed) { DestroyBlock(player); _posBeforeBounce = transform.position; _bounceState = BounceState.Up; } }
override protected void DestroyBlock(SMBPlayer player) { if (player.State == SMBConstants.PlayerState.GrownUp) { SMBGameWorld.Instance.PlayParticle(transform.position, "SMBBlockParticleSystem"); SMBGameWorld.Instance.PlaySoundEffect((int)SMBConstants.GameWorldSoundEffects.BreakBlock); //for Mario's OnTriggerStay Interaction = "Break"; Action = "Jump"; updateBeliefArray(); player.printArray(beliefArray); Destroy(gameObject); } }
override protected void DestroyBlock(SMBPlayer player) { _isDestroyed = true; _animator.SetTrigger("triggerDestroy"); }
protected virtual void DestroyBlock(SMBPlayer player) { }