public int attack(AttackingEntity structure, GameObject[] targets)
    {
        int returnCode = 0;

        foreach( GameObject tgt in targets){
            if(tgt){
                GameObject center = structure.transform.GetChild(0).gameObject;
                GameObject gun	  = center.transform.GetChild(0).gameObject;
                Quaternion rot =  Quaternion.Slerp(center.transform.rotation ,
                                             Quaternion.LookRotation(tgt.transform.position  - center.transform.position) , 100f);
                center.transform.rotation = Quaternion.Euler(0, rot.eulerAngles.y, 0);
                center.transform.Rotate(Vector3.up, -90);
                if(Time.realtimeSinceStartup - structure.lastShot > 1 || structure.lastShot == 0){
                    gun.transform.GetChild(0).particleSystem.Play();
                    GameObject newShot = Object.Instantiate(Resources.Load("Prefabs/Nail")) as GameObject;
                    newShot.name = "Shot" + Time.realtimeSinceStartup;
                    newShot.transform.position = gun.transform.position;
                    Shot shot = newShot.GetComponent<Shot>();
                    shot.target = tgt.gameObject;
                    shot.dps = structure.structureStats.dps;
                    structure.lastShot = Time.realtimeSinceStartup;
                }
            }
            else{
                returnCode = 1;
            }
        }
        return returnCode;
    }
 public void removeAuraEffects(AttackingEntity structure, GameObject target)
 {
     try{
         Bot bot = target.GetComponent<Bot>();
         bot.removeEffect(effect);
     }catch{ return; }
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     m_movingEntity              = GetComponent <MovingEntity>();
     m_attackingEntity           = GetComponent <AttackingEntity>();
     m_actor                     = GetComponent <SynchronizedActor>();
     m_levelBuilder              = FindObjectOfType <LevelBuilder>();
     m_actor.OnTurnStatusChange += actor_OnTurnStatusChange;
 }
 public void applyAuraEffects(AttackingEntity structure, GameObject target)
 {
     try{
         Bot bot = target.GetComponent<Bot>();
         if(bot != null){
             effect.Source = structure.gameObject;
             bot.addEffect(effect);
         }
     }catch{ return; }
 }
Пример #5
0
    // Use this for initialization
    protected void Start()
    {
        AttackingEntity e = GetComponent <AttackingEntity>();

        e.AssignWeapon(AttackingEntity.WeaponSlot.Primary, primary);
        if (secondary != null)
        {
            e.AssignWeapon(AttackingEntity.WeaponSlot.Secondary, secondary);
        }
    }
Пример #6
0
    // Use this for initialization
    protected void Start()
    {
        AttackingEntity ae = GetComponent <AttackingEntity>();

        switch (type)
        {
        case MonsterType.Heavy:
            ae.AssignWeapon(AttackingEntity.WeaponSlot.Primary, WeaponList.MutantHammer);
            break;

        case MonsterType.Stalker:
            ae.AssignWeapon(AttackingEntity.WeaponSlot.Primary, WeaponList.MutantClaw);
            break;

        case MonsterType.Walker:
            ae.AssignWeapon(AttackingEntity.WeaponSlot.Primary, WeaponList.MutantFist);
            break;
        }
    }
 public void applyAuraEffects(AttackingEntity structure, GameObject target)
 {
     return;
 }
 public int attack(AttackingEntity structure, GameObject[] targets)
 {
     return structureBehavior.attack(structure,targets);
 }
 public int attack(AttackingEntity structure, GameObject[] targets)
 {
     return 0;
 }