// Use this for initialization
    void Start()
    {
        Assert.IsNotNull(mainBody);
        Assert.IsNotNull(teamAttribute);
        Assert.IsNotNull(healthAttribute);
        Assert.IsNotNull(movementAttribute);
        privCheckLayer();
        if (tag == "Player")
        {
            playerIdentity = this;
        }

        OnSpawn.Invoke();
    }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (user != null && !prevEquiped)
     {
         OnEquiped.Invoke();
         prevEquiped = true;
     }
     else if (user == null && prevEquiped)
     {
         OnDequiped.Invoke();
         prevEquiped = false;
         user        = null;
     }
 }
Пример #3
0
    public void inflict(AttackInfo attackInfo)
    {
        Abstract_Identity activator = attackInfo.activator;
        // Victim must be human
        Human_Identity victim = attackInfo.victim.GetComponent <Human_Identity>();

        if (victim != null)
        {
            Infection victimInfectionComponent = victim.getInfectionComponent();
            Assert.IsNotNull(victimInfectionComponent);
            Zombie_Identity activatorZomb = (Zombie_Identity)activator;
            Assert.IsNotNull(activatorZomb);

            // Infect
            float infectiousness = activatorZomb.GetInfectiousness();
            victimInfectionComponent.addInfection(infectiousness, activatorZomb);
        }
    }
Пример #4
0
    public void inflict(AttackInfo attackInfo)
    {
        if (attackInfo.activator == null)
        {
            attackInfo.activator = World_Identity.singleton;
        }

        Assert.IsNotNull(attackInfo.activator);
        Assert.IsNotNull(attackInfo.victim);

        Abstract_Identity activator = attackInfo.activator;
        Abstract_Identity victim    = attackInfo.victim.GetComponent <Abstract_Identity>();

        // Hit character
        if (victim != null)
        {
            victim.getHealthComponent().subtractHealth(new DamageInfo(attackInfo.damage, activator.transform.position - victim.transform.position, activator));
        }
        else
        {
        }
    }
Пример #5
0
 public void setUser(Abstract_Identity newUser)
 {
     user = newUser;
 }
Пример #6
0
 public AttackInfo(Abstract_Identity _activator)
 {
     activator = _activator;
     posImpact = new Vector2();
 }
Пример #7
0
 public DamageInfo(float _damageAmount, Vector2 _direction, Abstract_Identity _activator)
 {
     damageAmount = _damageAmount;
     direction    = _direction;
     activator    = _activator;
 }