Beispiel #1
0
 void OnTriggerStay(Collider other)
 {
     //checks to see if we are close enuff and we be human
     if (other.GetComponent <Collider>().tag == "Player")
     {
         currentHolder = other.gameObject;
         hasTreasure   = currentHolder.name;
         Move2p moveCache = currentHolder.gameObject.GetComponent <Move2p> ();
         moveCache.UpdateTreasure(true);
     }
 }
Beispiel #2
0
    IEnumerator DeathCoroutine()
    {
        Debug.Log(gameObject.name + " has died");
        if (gameObject.name == treasureCache.hasTreasure)
        {
            treasureCache.hasTreasure = "none";
            treasureCache.MoveTreasure2Dead();
        }
        Move2p      moveCache = gameObject.GetComponent <Move2p> ();
        BoxCollider boxy      = gameObject.GetComponent <BoxCollider> ();

        foreach (GameObject obj in playerDisableOnDeath)
        {
            obj.SetActive(false);
        }
        moveCache.enabled = false;
        boxy.enabled      = false;
        RemoveArrows();
        Vector3 v3Current = new Vector3(0, 0, 0);

        v3Current = transform.eulerAngles;
        Quaternion qRotation = Quaternion.identity;

        qRotation.eulerAngles = v3Current;
        Instantiate(deathRagdoll, transform.position, qRotation);
        health = maxHealth;

        while (playerRespawnTime > 0)
        {
            yield return(new WaitForSeconds(1));

            playerRespawnTime--;
            Debug.Log(gameObject.name + " time to respawn " + playerRespawnTime);
        }



        if (playerRespawnTime <= 0)
        {
            Transform rndSpwn = reCache.PlayerRandomSpawn().transform;
            transform.position = rndSpwn.position;
            foreach (GameObject obj in playerDisableOnDeath)
            {
                obj.SetActive(true);
            }
            boxy.enabled      = true;
            moveCache.enabled = true;
            moveCache.UpdateTreasure(false);
            playerRespawnTime = maxPlayerRespawnTime;
        }
    }
Beispiel #3
0
 // Use this for initialization
 void Awake()
 {
     moveCache         = GetComponentInParent <Move2p> ();
     crossBow          = GetComponent <Animator> ();
     Screen.lockCursor = true;
 }