public void AttackTarget(float damage) { PlayerController pc = (PlayerController)target.GetComponent <PlayerController>(); if (pc != null) { if (!pc.Dodged) { AudioManager.Instance.SoundBank.PlayCue("hit"); } pc.DecreaseHealth(damage); } else { if (this.MyObject.Name.Contains("Mutant")) { damage *= 10; } Fortification f = (Fortification)target.GetComponent <Fortification>(); if (f != null) { AudioManager.Instance.SoundBank.PlayCue("fortificationHit"); f.CurrentHealth -= (uint)damage; } else { f = (Fortification)target.GetParent().GetComponent <Fortification>(); if (f != null) { AudioManager.Instance.SoundBank.PlayCue("fortificationHit"); f.CurrentHealth -= (uint)damage; } } } }
public override void OnTrigger(GameObject other) { if (targetDead) { return; } if (target != null && target.UniqueID != 1) { return; } bool fort = other.Tags.Contains("Fortification"); if (other.UniqueID == 1 || fort) { myMutant.MyBlackBoard.SetBool("TargetSeen", true); targetSeen = true; target = other; myMutant.myEnemyScript.target = other; pc = (PlayerController)target.GetComponent <PlayerController>(); if (fort) { target = other.GetParent(); f = (Fortification)target.GetComponent <Fortification>(); if (f == null) { f = (Fortification)target.GetComponent <Fortification>(); } } Vector3 pos = target.MyTransform.Position; myMutant.MyBlackBoard.SetVector3("TargetPosition", pos); } base.OnTrigger(other); }
public Fortification(GameObject mObj, Fortification ff) : base(mObj, ff) { this.MyType = ff.MyType; this.CurrentID = ff.CurrentID; Start(); }