Beispiel #1
0
 public void instantiateNewUnit()
 {
     if (StateMachine.turnState != Turn.pause)
     {
         classInfo.Lookup(targetClass);
         print(classInfo.cost);
         if (!StateMachine.isPlacingCube && driver.getPlayerPointsRemaining() > classInfo.cost)
         {
             print("GOING");
             newUnit = Instantiate(cubePrefab, new Vector3(0, 2, 0), Quaternion.identity) as GameObject;
             newUnit.GetComponent <Cube> ().playState = PlayState.placing;
             newUnit.GetComponent <UnitClass>().unitSetup(classInfo.Lookup(targetClass, newUnit.GetComponent <UnitClass>()));
             driver.placingCube(newUnit);
         }
     }
 }
 public void updateHoverInfo(string check)
 {
     lookup.Lookup(check);
     //image.sprite = .... Not sure how to do this yet. Figure it out later.
     className.text   = lookup.name2String();
     attack.text      = "Attack: " + lookup.attack;
     defense.text     = "Defense: " + lookup.defense;
     cost.text        = lookup.cost + "\nCost";
     description.text = lookup.description;
 }
Beispiel #3
0
 public void updateHoverInfo(string check)
 {
     lookup.Lookup(check);
     foreach (Transform t in this.transform)
     {
         if (t.gameObject.name == "Image")
         {
             TextureManager.applySprite(t.gameObject, lookup.texture[StateMachine.currentTurn() - 1]);
         }
     }
     className.text   = lookup.name2String();
     attack.text      = "Attack: " + lookup.attack;
     defense.text     = "Defense: " + lookup.defense;
     cost.text        = lookup.cost + "\nCost";
     description.text = lookup.description;
 }
    //Not currently in use.

    /*public void instantiateNewUnit()
     * {
     *  if (StateMachine.turnState != Turn.pause)
     *  {
     *                  classInfo.Lookup (targetClass);
     *                  print (classInfo.cost);
     *      if (!StateMachine.isPlacingCube && driver.getPlayerPointsRemaining() > classInfo.cost)
     *      {
     *                          newUnit = Instantiate(cubePrefab, new Vector3(0,2,0), Quaternion.identity) as GameObject;
     *                          newUnit.GetComponent<Cube> ().SetToPlacing();
     *                          newUnit.GetComponent<UnitClass>().unitSetup(classInfo.Lookup(targetClass, newUnit.GetComponent<UnitClass>()));
     *          driver.placingCube(newUnit);
     *      }
     *  }
     * }*/

    public void instantiateNewUnit(string target)      //An overload in case the interface calls it this way
    {
        if (StateMachine.turnState != Turn.pause)
        {
            classInfo.Lookup(target);
            if (StateMachine.gamePhase == GamePhase.setup && !StateMachine.isPlacingCube && driver.getPlayerPointsRemaining() >= classInfo.cost)
            {
                if (target == "King")
                {
                    if ((StateMachine.currentTurn() == 1 && StateMachine.p1King == true) || (StateMachine.currentTurn() == 2 && StateMachine.p2King == true))
                    {
                        return;
                    }
                }
                if (target == "Paralyze")
                {
                    if ((StateMachine.currentTurn() == 1 && StateMachine.p1Paralyze == true) || (StateMachine.currentTurn() == 2 && StateMachine.p2Paralyze == true))
                    {
                        return;
                    }
                }
                if (target == "Bomb")
                {
                    if ((StateMachine.currentTurn() == 1 && StateMachine.p1Bomb == true) || (StateMachine.currentTurn() == 2 && StateMachine.p2Bomb == true))
                    {
                        return;
                    }
                }
                if (target == "Healer")
                {
                    if ((StateMachine.currentTurn() == 1 && StateMachine.p1Healer == true) || (StateMachine.currentTurn() == 2 && StateMachine.p2Healer == true))
                    {
                        return;
                    }
                }
                if (target == "Peasant")
                {
                    if ((StateMachine.currentTurn() == 1 && StateMachine.p1Peasant >= StateMachine.peasantLimit) || (StateMachine.currentTurn() == 2 && StateMachine.p2Peasant >= StateMachine.peasantLimit))
                    {
                        return;
                    }
                }
                newUnit = Instantiate(cubePrefab) as GameObject;
                newUnit.GetComponent <Cube>().SetToPlacing();
                newUnit.GetComponent <UnitClass>().unitSetup(classInfo.Lookup(target, newUnit.GetComponent <UnitClass>()));
                driver.placingCube(newUnit);
            }
            else if (StateMachine.gamePhase == GamePhase.healer && !StateMachine.isPlacingCube && classInfo.cost + driver.healerPoints <= driver.healMax && GameDriver.checkDeadCubes(StateMachine.currentTurn(), target))
            {
                newUnit = Instantiate(cubePrefab) as GameObject;
                newUnit.GetComponent <Cube>().SetToPlacing();
                newUnit.GetComponent <UnitClass>().unitSetup(classInfo.Lookup(target, newUnit.GetComponent <UnitClass>()));
                driver.placingCube(newUnit);
            }
        }
    }