Esempio n. 1
0
 public void AddTeamAfter(GameManager.Teams aAfter, GameManager.Teams bAfter, int unitAAfter, int unitBAfter)
 {
     teamAAfter      = aAfter;
     teamBAfter      = bAfter;
     this.unitAAfter = unitAAfter;
     this.unitBAfter = unitBAfter;
 }
Esempio n. 2
0
 public Movement(int units, List <HexTile> newPath, GameManager.Teams team)
 {
     this.team  = team;
     this.units = units;
     path       = newPath;
     newPath[0].movementsFromTile.Add(this);
 }
Esempio n. 3
0
 public BulletManager(int amount, float bulletDamage, GameObject bulletPrefab, GameManager.Teams team)
 {
     this.bulletDamage = bulletDamage;
     this.bulletPrefab = bulletPrefab;
     this.team         = team;
     PrecreateObjects(amount);
 }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        SphereCollider atkRadius = GetComponent <SphereCollider>();

        unit                = gameObject.GetComponentInParent <Unit>();
        atkRadius.radius    = unit.GetStats.Range;
        atkRadius.isTrigger = true;

        if (unit.Team == GameManager.Teams.Enemy)
        {
            TargetTeam = GameManager.Teams.Player;
        }
        else
        {
            TargetTeam = GameManager.Teams.Enemy;
        }
    }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     team = hexTile.team;
     CheckNeighbouring();
     if (highlighted || isVisible())
     {
         isBlank = false;
         CalculateTextCanvasPos();
         UpdateTextDisplay();
         SetColor();
     }
     else
     {
         if (!isBlank)
         {
             SetBlank();
         }
     }
 }
Esempio n. 6
0
    // Change Own Color according to ID
    void SetTeamColor()
    {
        switch (ID)
        {
        case 1:
            team = GameManager.Teams.Gold;
            break;

        case 2:
            team = GameManager.Teams.Blue;
            break;

        case 3:
            team = GameManager.Teams.Red;
            break;

        default:
            team = GameManager.Teams.Null;
            break;
        }
    }
Esempio n. 7
0
 public void SetTeam(GameManager.Teams team)
 {
     this.team = team;
 }
Esempio n. 8
0
 public void AddTeamBefore(GameManager.Teams aBefore, GameManager.Teams bBefore)
 {
     teamABefore = aBefore;
     teamBBefore = bBefore;
 }
Esempio n. 9
0
    // Moves ALL Units from this tile to the other Tile
    public bool MoveUnitsToTile(HexTile otherTile, int Amount, bool replay)
    {
        otherTile.SetMoveLocked(otherTile.team == GameManager.current.activeTeam || otherTile.team == GameManager.Teams.Null);

        otherTile.CheckFree();

        // Not possible if Amount is bigger than available units
        if (Amount > units)
        {
            return(false);
        }
        // Same Team
        if (team == otherTile.team)
        {
            ChangedTile change = new ChangedTile(this, otherTile, -1, 1);
            change.AddTeamBefore(team, otherTile.team);

            otherTile.units += Amount;
            units           -= Amount;

            Player player = GameManager.current.GetPlayerByTeam(otherTile.team);

            GameManager.Teams after = units == 0 ? GameManager.Teams.Null : team;
            change.AddTeamAfter(after, otherTile.team, units, otherTile.units);
            if (replay)
            {
                player.replays.AddMovementToReplay(change);
            }

            if (change.teamBBefore != change.teamBAfter && change.teamBAfter != GameManager.Teams.Null)
            {
                Debug.Log("Marked Change " + change.tileA + "->" + change.tileB + ": SAME TEAM");
                change.Mark();
            }

            CheckFree();
            otherTile.CheckFree();

            return(true);
        }
        // Other Team
        if (otherTile.team != GameManager.Teams.Null)
        {
            ChangedTile change = new ChangedTile(this, otherTile, -1, -1);
            change.AddTeamBefore(team, otherTile.team);

            otherTile.units -= Amount;
            units           -= Amount;

            GameManager.Teams otherBefore = otherTile.team;

            // Conquered other Tile
            if (otherTile.units < 0)
            {
                Debug.Log("Conquered Tile! Shouldn't happen! Amount: " + Amount);
                GameManager.current.AddTileToPlayer(otherTile, GameManager.current.activePlayer);

                otherTile.units *= -1;
            }

            Player player = GameManager.current.GetPlayerByTeam(otherTile.team);

            GameManager.Teams afterOwn = units <= 0 ? GameManager.Teams.Null : team;

            GameManager.Teams afterOther;

            if (otherTile.units <= 0)
            {
                afterOther = GameManager.Teams.Null;
            }
            else
            {
                afterOther = otherTile.team;
            }


            change.AddTeamAfter(afterOwn, afterOther, units, otherTile.units);
            player.replays.AddMovementToReplay(change);

            if (change.teamBBefore != change.teamBAfter && change.teamBAfter != GameManager.Teams.Null)
            {
                Debug.Log("Marked Change " + change.tileA + "->" + change.tileB + ": OTHER TEAM");
                change.Mark();
            }

            if (replay)
            {
                GameManager.current.GetPlayerByTeam(team).replays.AddMovementToReplay(change);
            }

            CheckFree();
            otherTile.CheckFree();

            return(true);
        }
        // Empty HexTile
        if (otherTile.team == GameManager.Teams.Null)
        {
            ChangedTile change = new ChangedTile(this, otherTile, -1, 1);
            change.AddTeamBefore(team, otherTile.team);

            GameManager.current.AddTileToPlayer(otherTile, GameManager.current.activePlayer);

            otherTile.units = Amount;
            units          -= Amount;


            Player player = GameManager.current.GetPlayerByTeam(team);

            GameManager.Teams after = units == 0 ? GameManager.Teams.Null : team;
            change.AddTeamAfter(after, otherTile.team, units, otherTile.units);


            if (change.teamBBefore != change.teamBAfter && change.teamBAfter != GameManager.Teams.Null && change.teamBBefore != GameManager.Teams.Null)
            {
                Debug.Log("Marked Change " + change.tileA + "->" + change.tileB + ": EMPTY");
                change.Mark();
            }

            if (replay)
            {
                player.replays.AddMovementToReplay(change);
            }

            CheckFree();
            otherTile.CheckFree();

            return(true);
        }

        return(false);
    }
Esempio n. 10
0
 public RocketManager(int amount, GameObject rocketPrefab, GameManager.Teams team)
 {
     this.rocketPrefab = rocketPrefab;
     this.team         = team;
     PrecreateObjects(amount);
 }