Пример #1
0
 public void SetTarget(Character_Handler pc)
 {
     if (currTarget == null || currTarget.gameObject.activeSelf == false)
     {
         currTarget = pc;
     }
 }
Пример #2
0
    public bool CheckForPlayers(int originX, int originY, int range)
    {
        // Looping through the tiles in an area surrounding this enemy, limited by range
        for (int x = originX - range; x < originX + range; x++)
        {
            for (int y = originY - range; y < originY + range; y++)
            {
                //foreach(Character_Handler pc in Battle_Loader.Instance.playerSquadMap.Values)
                // {
                //     if (pc.GetCurrentTileCoords() == new Vector2(x, y))
                //     {
                //         Debug.Log("ENEMY: Found target at " + new Vector2(x, y));
                //         currTarget = pc;
                //         return true;
                //     }
                // }
                currTarget = Battle_Controller.Instance.GetPCAtVector2(new Vector2(x, y));

                if (currTarget != null)
                {
                    Debug.Log("ENEMY: Found target at " + new Vector2(x, y));
                    return true;
                }
            }
        }

        Debug.Log("ENEMY BATTLE: Found no player characters in range!");
        return false;
     
    }
Пример #3
0
    public bool CheckForPlayers(int originX, int originY, int range)
    {
        // Looping through the tiles in an area surrounding this enemy, limited by range
        for (int x = originX - range; x < originX + range; x++)
        {
            for (int y = originY - range; y < originY + range; y++)
            {
                //foreach(Character_Handler pc in Battle_Loader.Instance.playerSquadMap.Values)
                // {
                //     if (pc.GetCurrentTileCoords() == new Vector2(x, y))
                //     {
                //         Debug.Log("ENEMY: Found target at " + new Vector2(x, y));
                //         currTarget = pc;
                //         return true;
                //     }
                // }
                currTarget = Battle_Controller.Instance.GetPCAtVector2(new Vector2(x, y));

                if (currTarget != null)
                {
                    Debug.Log("ENEMY: Found target at " + new Vector2(x, y));
                    return(true);
                }
            }
        }

        Debug.Log("ENEMY BATTLE: Found no player characters in range!");
        return(false);
    }
Пример #4
0
 public void SetNewPCPosition(Vector2 newPos, Character_Handler pc)
 {
     if (!PCPositionsMap.ContainsKey(newPos))
     {
         PCPositionsMap.Add(newPos, pc);
         Debug.Log("BATTLE CONTROL: Set new PC position at " + newPos);
     }
 }
Пример #5
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #6
0
    public void ReSetPCPosition(Vector2 oldPos, Vector2 newPos, Character_Handler pc)
    {
        if (PCPositionsMap.ContainsKey(oldPos))
        {
            PCPositionsMap.Remove(oldPos);
            Debug.Log("BATTLE CONTROL: Removed PC position at " + oldPos);

            SetNewPCPosition(newPos, pc);
        }
        else
        {
            SetNewPCPosition(newPos, pc);
        }
    }
Пример #7
0
    public void KillPC(Character_Handler pc)
    {
        if (Battle_Loader.Instance.playerSquadMap.ContainsKey(pc.myChar.Name))
        {
            // Remove from player squad dictionary
            Battle_Loader.Instance.playerSquadMap.Remove(pc.myChar.Name);
        }


        // Check if player has lost all their units
        if (Battle_Loader.Instance.playerSquadMap.Count < 1)
        {
            Battle_StateManager.Instance.Lose();
        }
    }
Пример #8
0
 void Start()
 {
     char_handler = GetComponent<Character_Handler>();
 }
Пример #9
0
 void DoDamage(Character_Handler character, float dmg)
 {
     Debug.Log("ENEMY: Damaging " + character.myChar.Name + " for " + dmg);
     character.TakeDamage(dmg);
 }
Пример #10
0
 void Awake()
 {
     char_handler = GetComponent <Character_Handler>();
 }
Пример #11
0
    public void KillPC(Character_Handler pc)
    {
        if (Battle_Loader.Instance.playerSquadMap.ContainsKey(pc.myChar.Name))
        {
            // Remove from player squad dictionary
            Battle_Loader.Instance.playerSquadMap.Remove(pc.myChar.Name);
        }
     

        // Check if player has lost all their units
        if (Battle_Loader.Instance.playerSquadMap.Count < 1)
        {
            Battle_StateManager.Instance.Lose();
        }
    }
Пример #12
0
    public void ReSetPCPosition(Vector2 oldPos, Vector2 newPos, Character_Handler pc)
    {
        if (PCPositionsMap.ContainsKey(oldPos))
        {
            PCPositionsMap.Remove(oldPos);
            Debug.Log("BATTLE CONTROL: Removed PC position at " + oldPos);

            SetNewPCPosition(newPos, pc);
        }
        else
        {
            SetNewPCPosition(newPos, pc);
        }
    }
Пример #13
0
 public void SetNewPCPosition(Vector2 newPos, Character_Handler pc)
 {
     if (!PCPositionsMap.ContainsKey(newPos))
     {
         PCPositionsMap.Add(newPos, pc);
         Debug.Log("BATTLE CONTROL: Set new PC position at " + newPos);
     }
 }
Пример #14
0
 void Start()
 {
     char_handler = GetComponent <Character_Handler>();
 }
Пример #15
0
 public void SetTarget(Character_Handler pc)
 {
     if (currTarget == null || currTarget.gameObject.activeSelf == false)
         currTarget = pc;
 }
Пример #16
0
 void DoDamage(Character_Handler character, float dmg)
 {
     Debug.Log("ENEMY: Damaging " + character.myChar.Name + " for " + dmg);
     character.TakeDamage(dmg);
 }
Пример #17
0
 void Awake()
 {
    
     char_handler = GetComponent<Character_Handler>();
 }