Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <SMBPlayer>();

        beliefArray = new string[4];
        updateBeliefArray();
    }
Exemplo n.º 3
0
    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);
        }
    }
Exemplo n.º 4
0
    void OnInteraction(SMBPlayer player)
    {
        if (_bounceState == BounceState.None && !_isDestroyed)
        {
            DestroyBlock(player);

            _posBeforeBounce = transform.position;
            _bounceState     = BounceState.Up;
        }
    }
Exemplo n.º 5
0
    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);
        }
    }
Exemplo n.º 6
0
 override protected void DestroyBlock(SMBPlayer player)
 {
     _isDestroyed = true;
     _animator.SetTrigger("triggerDestroy");
 }
Exemplo n.º 7
0
 protected virtual void DestroyBlock(SMBPlayer player)
 {
 }