Ejemplo n.º 1
0
    void HandleInput(GameObject dragObject)
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (!isDragging)
            {
                currentDragObject = dragObject;
                isDragging        = true;
            }
            else
            {
                currentDragObject = null;
                isDragging        = false;
            }
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            InjuredSoldier soldier = dragObject.GetComponent <InjuredSoldier>();
            if (!soldier.isStableized && numMedkits > 0)
            {
                soldier.Stableize();
                numMedkits--;
                RenderMedkits();
            }
        }


        if (currentDragObject)
        {
            currentDragObject.transform.position = transform.position;
        }
    }
Ejemplo n.º 2
0
    IEnumerator SpawnInjuredSoldier()
    {
        while (isPlaying)
        {
            InjuredSoldier soldierObject = (InjuredSoldier)Instantiate(injuredSoldier, new Vector3(positionToSpawnSoldier.x, positionToSpawnSoldier.y, 0.1f), Quaternion.identity);
            positionToSpawnSoldier = Random.insideUnitCircle * injuredSoldierSpawnRadius;
            playerController.injuredSoldiers.Add(soldierObject);

            yield return(new WaitForSeconds(injuredSoldierSpawnRate));
        }
    }
Ejemplo n.º 3
0
 void OnTriggerExit(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         isPlayerInRadius = false;
     }
     if (col.gameObject.tag == "InjuredSoldier")
     {
         isSoldierInRadius = false;
         soldier           = null;
     }
 }
Ejemplo n.º 4
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         isPlayerInRadius = true;
     }
     if (col.gameObject.tag == "InjuredSoldier")
     {
         isSoldierInRadius = true;
         soldier           = col.gameObject.GetComponent <InjuredSoldier>();
     }
 }