コード例 #1
0
    public void setPawn(PawnClass type, int x, int y, int team)
    {
        if (pawns [x, y] != null)
        {
            return;
        }
        Pawn newPawn = null;

        if (type == PawnClass.Warrior)
        {
            newPawn = (Pawn)Instantiate(WarriorPrefab, new Vector3(-7 + 2 * x, 1.0f, -7 + 2 * y), Quaternion.identity);
        }
        else if (type == PawnClass.Wizard)
        {
            newPawn = (Pawn)Instantiate(WizardPrefab, new Vector3(-7 + 2 * x, 1.0f, -7 + 2 * y), Quaternion.identity);
        }
        else if (type == PawnClass.Archer)
        {
            newPawn = (Pawn)Instantiate(ArcherPrefab, new Vector3(-7 + 2 * x, 1.0f, -7 + 2 * y), Quaternion.identity);
        }
        else if (type == PawnClass.Farmer)
        {
            newPawn = (Pawn)Instantiate(FarmerPrefab, new Vector3(-7 + 2 * x, 1.0f, -7 + 2 * y), Quaternion.identity);
        }
        newPawn.setPosition(x, y);
        newPawn.setTeam(team);
        newPawn.setPawnController(this);
        pawns[x, y] = newPawn;
    }
コード例 #2
0
 public void setPawn(PawnClass type,int x,int y,int team)
 {
     if (pawns [x, y] != null)
         return;
     Pawn newPawn =  null;
     if(type == PawnClass.Warrior)
         if(team==0)
         newPawn = (Pawn)Instantiate(RedWarriorPrefab,pawnPosition(x, y),Quaternion.identity);
         else
         newPawn = (Pawn)Instantiate(BlueWarriorPrefab,pawnPosition(x, y),Quaternion.identity);
     else if(type==PawnClass.Wizard)
         if(team==0)
         newPawn = (Pawn)Instantiate(RedWizardPrefab,pawnPosition(x, y),Quaternion.identity);
         else
         newPawn = (Pawn)Instantiate(BlueWarriorPrefab,pawnPosition(x, y),Quaternion.identity);
     else if(type==PawnClass.Archer)
         if(team==0)
         newPawn = (Pawn)Instantiate(RedArcherPrefab,pawnPosition(x, y),Quaternion.identity);
         else
         newPawn = (Pawn)Instantiate(BlueWarriorPrefab,pawnPosition(x, y),Quaternion.identity);
     else if(type==PawnClass.Farmer)
         if(team==0)
         newPawn = (Pawn)Instantiate(RedFarmerPrefab,pawnPosition(x, y),Quaternion.identity);
         else
         newPawn = (Pawn)Instantiate(BlueWarriorPrefab,pawnPosition(x, y),Quaternion.identity);
     newPawn.setPosition(x,y);
     newPawn.setTeam(team);
     newPawn.setPawnController(this);
     pawns[x,y]= newPawn;
 }
コード例 #3
0
 public void setPawn(PawnClass type,int x,int y,int team)
 {
     if (pawns [x, y] != null)
         return;
     Pawn newPawn =  null;
     if(type == PawnClass.Warrior)
         newPawn = (Pawn)Instantiate(WarriorPrefab,new Vector3(-7+2*x,1.0f,-7+2*y),Quaternion.identity);
     else if(type==PawnClass.Wizard)
         newPawn = (Pawn)Instantiate(WizardPrefab,new Vector3(-7+2*x,1.0f,-7+2*y),Quaternion.identity);
     else if(type==PawnClass.Archer)
         newPawn = (Pawn)Instantiate(ArcherPrefab,new Vector3(-7+2*x,1.0f,-7+2*y),Quaternion.identity);
     else if(type==PawnClass.Farmer)
         newPawn = (Pawn)Instantiate(FarmerPrefab,new Vector3(-7+2*x,1.0f,-7+2*y),Quaternion.identity);
     newPawn.setPosition(x,y);
     newPawn.setTeam(team);
     newPawn.setPawnController(this);
     pawns[x,y]= newPawn;
 }