Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (isActivated)
        {
            timerRespawn += Time.deltaTime;
            if (timerRespawn >= timerRespawnLimit)
            {
                timerRespawn = 0;
                // Lançar flechas
                GameObject gameObj = (GameObject)Instantiate(
                    trapPrefab.gameObject,
                    transform.position,
                    Quaternion.identity
                    );

                ITrap trap = gameObj.GetComponent <ITrap>();
                trap.Begin();
                trap.IsActivated = true;
                trap.Player      = player;
                trap.Direction   = direction;
                if (frequencyZAxis)
                {
                    trap.transform.rotation = rotation;
                }

                if (!trap.IsRespawn)
                {
                    isActivated = false;
                }
            }
        }
    }