public virtual Surroundings mouseDown()
    {
        Surroundings surroundings = terrain.expandByAP(this.actionPoints);

        surroundings.paint(Color.red);
        return(surroundings);
    }
 //public Surroundings previewTrap(){
 public void previewTrap(){
    if(!skills[0].canUse()) return;
    GameController.console.Log("Previewing trap\n");
    preview = terrain.expandByDistance(terrain.movePointsRequired);
    GameController.overrideClick(trySetTrap);
    preview.paint(Color.blue);
 }
예제 #3
0
 private static void selectCreature(Creature creature)
 {
     if (possibilities != null)
     {
         clearAll();
     }
     creatureClicked = creature;
     if (creature != null)
     {
         GameObject.FindGameObjectWithTag("SoundController").GetComponent <Sound_controller>().playClick();
         int ap    = creature.actionPoints;
         int range = creature.attackRange;
         if (creature is HumanKnight && creature.terrain is Plains && creature.actionPoints > 0)
         {
             ap++;
         }
         if (creature is HumanSiege)
         {
             if ((creature as HumanSiege).isMounted)
             {
                 ap = 0;
             }
             else
             {
                 range = 0;
             }
         }
         if (creature is UndeadSiege)
         {
             if ((creature as UndeadSiege).isMounted)
             {
                 ap = 0;
             }
             else
             {
                 range = 0;
             }
         }
         possibilities = creature.terrain.expandByAP(ap);
         possibilities.paint(Color.red);
         attackPossibilities = creature.terrain.expandByDistance(range);
         for (int aux = 0; aux < attackPossibilities.creatures.Count; aux++)
         {
             Creature targetCreature = attackPossibilities.creatures[aux].second;
             if (targetCreature.team != creature.team)
             {
                 targetCreature.terrain.setColor(Color.blue);
             }
         }
     }
     else
     {
         possibilities       = null;
         attackPossibilities = null;
     }
     guiController.selectCreature(creature);
 }
 public void previewSupress()
 {
     if (!skills[2].canUse())
     {
         return;
     }
     supressSurroundings = terrain.expandByDistance(2);
     GameController.overrideClick(trySupress);
     supressSurroundings.paint(Color.blue);
 }
 public void previewRevive()
 {
     if (!skills[1].canUse())
     {
         return;
     }
     reviveSurroundings = terrain.expandByDistance(1);
     GameController.overrideClick(tryRevive);
     reviveSurroundings.paint(Color.blue);
 }
예제 #6
0
 public void previewCorner()
 {
     if (!skills[1].canUse())
     {
         return;
     }
     cornerSurroundings = terrain.expandByDistance(2);
     GameController.overrideClick(tryCorner);
     cornerSurroundings.paint(Color.blue);
 }
예제 #7
0
 public void previewPossess()
 {
     if (!skills[1].canUse())
     {
         return;
     }
     possessSurroundings = terrain.expandByDistance(3);
     GameController.overrideClick(tryPossess);
     possessSurroundings.paint(Color.blue);
 }
예제 #8
0
 public void previewCursedTouch()
 {
     if (!skills[0].canUse())
     {
         return;
     }
     cursedTouchSurroundings = terrain.expandByDistance(1);
     GameController.overrideClick(this.tryCursedTouch);
     cursedTouchSurroundings.paint(Color.blue);
 }
예제 #9
0
    public void tryPossess(Terrain terrain)
    {
        possessSurroundings.clear();

        if (!possessSurroundings.hasTerrain(terrain.x, terrain.y))
        {
            Debug.Log("out of range");
            return;
        }
        if (terrain.creature == null)
        {
            GameController.console.Log("invalid target\n");
            return;
        }
        if (terrain.creature is UndeadKnight && (terrain.creature as UndeadKnight).isImmaterial)
        {
            GameController.console.Log("Cannot use habilities on immaterial undead knight");
            return;
        }
        GameController.overrideClick(tryPossess2);
        possessSurroundings = terrain.expandByDistance(3);
        possessSurroundings.paint(Color.blue);
    }
예제 #10
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha0))
        {
            if (creatureClicked != null)
            {
                creatureClicked.defend();
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (creatureClicked is HumanKnight)
            {
                (creatureClicked as HumanKnight).assault();
            }
            else if (creatureClicked is HumanSiege)
            {
                (creatureClicked as HumanSiege).toggleMount();
                selectCreature(creatureClicked);
            }
            else if (creatureClicked is HumanArcher)
            {
                possibilities.clear();
                possibilities = (creatureClicked as HumanArcher).previewTrap();
                if (possibilities == null)
                {
                    selectCreature(null);
                }
                else
                {
                    possibilities.paint(new Color(255, 255, 0));
                    trapPreview = true;
                }
            }
            else if (creatureClicked is HumanSoldier)
            {
                (creatureClicked as HumanSoldier).raiseShields();
                selectCreature(creatureClicked);
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (creatureClicked is HumanSiege)
            {
                (creatureClicked as HumanSiege).habilityPush();
                selectCreature(creatureClicked);
            }
        }

        /*-------GUI Scripting----------*/
        if (creatureClicked != null)
        {
            //Assigning Selected creature's value to diplay on GUI
            text_name.text = "Name: " + creatureClicked.name;
            text_team.text = "Team: " + creatureClicked.teamName;
            text_HP.text   = "HP: " + creatureClicked.health.ToString();
            text_AP.text   = "AP: " + creatureClicked.actionPoints.ToString();
            text_DE.text   = "DE: " + creatureClicked.defenseResistance.ToString();
            text_AT.text   = "AT: " + creatureClicked.attackDamage.ToString();
            //text_EV.text = "EV: " + creatureClicked.evasion.ToString();

            //Assigning Selected creature's image file to display on GUI
            if (creatureClicked is HumanArcher)
            {
                unitImgObject.GetComponent <Image>().sprite = Harcher;
            }
            else if (creatureClicked is HumanHero)
            {
                unitImgObject.GetComponent <Image>().sprite = HHero;
            }
            else if (creatureClicked is HumanKnight)
            {
                unitImgObject.GetComponent <Image>().sprite = HKnight;
            }
            else if (creatureClicked is HumanSiege)
            {
                unitImgObject.GetComponent <Image>().sprite = HSiege;
            }
            else if (creatureClicked is HumanSoldier)
            {
                unitImgObject.GetComponent <Image>().sprite = HSoldier;
            }
        }
        else
        {
            text_name.text = "Name: ";
            text_team.text = "Team: ";
            text_HP.text   = "HP: ";
            text_AP.text   = "AP: ";
            text_DE.text   = "DE: ";
            text_AT.text   = "AT: ";
            text_EV.text   = "EV: ";
            unitImgObject.GetComponent <Image>().sprite = blankImg;
        }
        /*-----------------------------*/
    }