void OnValidate() { mob = GetComponentInParent <EnemyShipModular>(); if (mob != null) { DisplayDebug(); } }
public void TextureChange(EnemyShipModular selfShip) { if (selfShip.gameObject.tag == "Threat" || selfShip.gameObject.tag == "Boss") { gameObject.GetComponent <Renderer>().material = threatTexture; } else if (selfShip.gameObject.tag == "Ally" || selfShip.gameObject.tag == "Objective") { gameObject.GetComponent <Renderer>().material = allyTexture; } }
void OnTriggerEnter(Collider other) { EnemyShipModular ship = other.GetComponentInParent <EnemyShipModular>(); if (ship != null) { //don't hit if self! if (ship.gameObject == shooter) { return; } } Hit(other); }
public void setShooter(GameObject newShooter) { if (!newShooter) { return; } //passes IFF to round shooter = newShooter; EnemyShipModular shooterMob = shooter.GetComponentInParent <EnemyShipModular>(); if (shooterMob != null) { shooterIff = shooterMob.iff; } }
public void setShooter(GameObject newShooter) { if (!newShooter) { //Default to player if no shooter assigned shooterIff = EnemyShipModular.mobAffiliation.Ally; shooter = ScoreKeeper.playerAlive; return; } //passes IFF to round shooter = newShooter; EnemyShipModular shooterMob = shooter.GetComponentInParent <EnemyShipModular>(); if (shooterMob != null) { shooterIff = shooterMob.iff; } }
public GameObject ControlledFire(GameObject broadTarget) { if (broadTarget.GetComponent <EnemyShipModular>()) { EnemyShipModular bigship = broadTarget.GetComponent <EnemyShipModular>(); if (bigship.engines.Length > 0) { for (int i = 0; i < bigship.engines.Length; i++) { if (bigship.engines[i].enginePower > 0) { return(bigship.engines[i].gameObject); } } } if (bigship.weapon.Length > 0) { GameObject closestGun = bigship.weapon[0].gameObject; foreach (EnemyGunTurret gun in bigship.weapon) { if (gun != null) { if (Vector3.Distance(gun.transform.position, transform.position) < Vector3.Distance(closestGun.transform.position, transform.position)) { closestGun = gun.gameObject; } } } return(closestGun); } } //if nothing else, return broad target return(broadTarget.gameObject); //one mover for the gun, one for the muzzle }
void OnTriggerEnter(Collider other) { // if (minDistance < Vector3.Distance(transform.position, initPosition)) // { // Hit(other); // } EnemyShipModular ship = other.GetComponentInParent <EnemyShipModular>(); if (ship != null) { if (ship.gameObject == shooter) { return; } } // if (minDistance < Vector3.Distance(transform.position, initPosition)) // return; Hit(other); }
public void Spawn() { if (areaObject != null) { areaObject.transform.position = transform.position; areaObject.transform.rotation = transform.rotation; mobShip = areaObject.GetComponent <EnemyShipModular>(); if (mobShip != null) { mobShip.stormTrooper = difficulty; mobShip.condition = Condition; mobShip.SetAlignment(Affiliation); mobShip.combat = CombatDisposition; mobShip.nextDestination = firstNav; mobShip.assaultMode = assault; if (assault) { mobShip.assaultTarget = Objective; } if (resting) { mobShip.condition = EnemyShipModular.mobCondition.anchored; } else { mobShip.condition = EnemyShipModular.mobCondition.active; } } } }
// Use this for initialization void Awake() { ship = GetComponent <EnemyShipModular>(); }
void Start() { ship = GetComponent <EnemyShipModular>(); }
void Start() { ship = transform.GetComponentInParent <EnemyShipModular>(); TextureChange(ship); }
void Start() { myShip = GetComponentInParent <EnemyShipModular>(); RestoreGun(); }