Beispiel #1
0
        public void AcknowledgeHandshake(Health receiver)
        {
            interimDamageInfo.receiver = receiver;
            //Here we sort out damage
            bool friendlyFireOn = false;
            switch (friendlyFire)
            {
                case FriendlyFire.OverrideOff:
                    friendlyFireOn = false;
                    break;

                case FriendlyFire.OverrideOn:
                    friendlyFireOn = true;
                    break;

                case FriendlyFire.Default:
                default:
                    friendlyFireOn = CombatSettings.friendlyFire;
                    break;
            }
            bool friendlyFaction = sourceFaction != null && ((sourceFaction.GetFactions() & receiver.GetFactions()) != 0);
            if (friendlyFaction && !friendlyFireOn)
                return;

            IDamageEvent[] list = this.GetInterfaces<IDamageEvent>();
            if (interimDamageInfo.amount > 0)
                foreach (IDamageEvent c in list) { c.OnDamageSent(interimDamageInfo); }
            else
                foreach (IDamageEvent c in list) { c.OnHealSent(interimDamageInfo); }
            receiver.ApplyDamage(interimDamageInfo);
        }
Beispiel #2
0
        public DamageInfo(float amount,
		DamageType type,
		Collider colliderHit,
		string damageIdentifier,
		Agent responsibleAgent = null)
        {
            this.colliderHit = colliderHit;
            this.type = type;
            this.receiver = null;
            this.damageIdentifier = damageIdentifier;
            this.amount = amount;
            this.responsibleAgent = responsibleAgent;
        }
Beispiel #3
0
 public void DisconnectHealth(Health scriptToDisconnect)
 {
     connectedHealthScripts.Remove(scriptToDisconnect);
 }
Beispiel #4
0
 public void ConnectHealth(Health scriptToConnect)
 {
     if (!connectedHealthScripts.Contains(scriptToConnect))
         connectedHealthScripts.Add(scriptToConnect);
 }