private void OnTriggerExit2D(Collider2D other)
 {
     if (other.transform.CompareTag("Player"))
     {
         mech = other.gameObject.GetComponent <MechBase>();
         mech.ChangeSafety(false);
     }
 }
Exemplo n.º 2
0
 public virtual void Fire()
 {
     mechInterface = GetComponentInParent <MechBase>();
     if (!firing)
     {
         launchShot();
         mechInterface.BuildHeat(heatValue);
         firing = true;
     }
 }
Exemplo n.º 3
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.transform.CompareTag("Player"))
        {
            IMech mech = other.gameObject.GetComponent <MechBase>();
            mech.TakeDamage(damage);
            enabled = false;
        }

        if (!(other.transform.CompareTag("SafeZone")))
        {
            Destroy(this.gameObject);
        }
    }
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (isActive)
     {
         if (other.transform.CompareTag("Player"))
         {
             mech = other.gameObject.GetComponent <MechBase>();
             mech.ChangeSafety(true);
         }
         else if (other.transform.CompareTag("Projectile"))
         {
             Destroy(other.gameObject);
         }
     }
 }
 public void initMech()
 {
     if (MechGameManager.instance.returnMech(playerNum) != null)
     {
         string mechpath = ("Scripts/Mechs/" + MechGameManager.instance.returnMech(playerNum));
         print(mechpath);
         controlledMech = Resources.Load(mechpath) as GameObject;
         mech           = Instantiate(controlledMech, transform.position, transform.rotation);
         print("Mech loaded correctly");
         mechActor = mech.GetComponent <MechBase>();
         mechActor.initMech();
         print("Mech stats initialised");
         mechActor.initWeapons();
         print("Mech weapons initialised");
         ui = transform.GetChild(0).gameObject;
         mechActor.setUI(ui);
         print("Mech UI initialised");
         MechGameManager.instance.AddMech();
     }
 }