Beispiel #1
0
    public void AddCTPObjectivePoints()
    {
        CapturePoint cp = mapArray[5, 3].GetComponent <CapturePoint>();

        if (cp.myUnit != null && cp.unitAttacked)
        {
            cp.turn         = 0;
            cp.unitAttacked = false;
        }
        else if (cp.myUnit == null)
        {
            cp.turn = 0;
        }
        else
        {
            cp.ownedBy = cp.myUnit.GetComponent <Character>().GetPlayer();
            cp.turn   += 1;
        }

        if (cp.turn > 2 && currentPlayer == cp.ownedBy)
        {
            if (currentPlayer == 1)
            {
                player1ObjectivePoints += 10;
            }
            else
            {
                player2ObjectivePoints += 10;
            }
        }

        Debug.Log(player1ObjectivePoints);
        Debug.Log(player2ObjectivePoints);
    }
Beispiel #2
0
 void OnTriggerExit(Collider collider)
 {
     if (collider.GetComponent <CapturePoint>() != null)
     {
         capturePoint = null;
     }
 }
Beispiel #3
0
        private void OnRemoveVisionBuff(byte[] packet, Channel channel)
        {
            if (!_isOdin || !_isOrder)
            {
                return;
            }

            switch (_captures)
            {
            case 0:
            case 1:
                Log.Write("[{0}] Capturing point B", _myPlayer);
                Send(Deserialize <CapturePoint>(CapturePoint.Create(_myNetId, _capturePoints[1])));
                break;

            case 3:
                Log.Write("[{0}] Capturing point C", _myPlayer);
                Send(Deserialize <CapturePoint>(CapturePoint.Create(_myNetId, _capturePoints[2])));
                break;

            case 5:
                Log.Write("[{0}] Capturing point D", _myPlayer);
                _gameStartTime = DateTime.Now;
                Send(Deserialize <CapturePoint>(CapturePoint.Create(_myNetId, _capturePoints[3])));
                break;
            }

            _captures++;
        }
    // Places a tile at position (x, y).
    private void PlaceTile(string tileType, int x, int y, Vector3 worldStart)
    {
        int tileIndex = int.Parse(tileType);

        // Creates a new tile instance.
        GameObject newTile = Instantiate(tilePrefabs[tileIndex]);

        if (newTile.GetComponent <TileBehavior>().tileType == "capturepoint")
        {
            capturePoint = newTile.GetComponent <CapturePoint>();
        }

        //Put under tile object in Hierarchy
        newTile.transform.SetParent(m_tilesObject.transform);

        // Calculates where it should go.
        float newX = worldStart.x + (tileSize * x);
        float newY = worldStart.y - (tileSize * y);

        // Puts it there.
        newTile.transform.position = new Vector3(newX, newY, 0);
        newTile.GetComponent <TileBehavior>().xPosition = x;
        newTile.GetComponent <TileBehavior>().yPosition = y;

        // Adds it to mapArray so we can keep track of it later.
        mapArray[x, y] = newTile;
    }
Beispiel #5
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.GetComponent <CapturePoint>() != null)
     {
         capturePoint = collider.GetComponent <CapturePoint>();
     }
 }
Beispiel #6
0
        public FlagDominationScenario(Scenario_Info info, int tier)
            : base(info, tier)
        {
            foreach (Scenario_Object obj in info.ScenObjects)
            {
                if (obj.Type == "Capture Point")
                {
                    CapturePoint cPoint = new CapturePoint(obj, CaptureValid, OnCapture);
                    _capturePoints.Add(cPoint);
                    Region.AddObject(cPoint, info.MapId);
                }

                else if (obj.Type == "Flag")
                {
                    _flag = new HoldObject(obj.Identifier, obj.ObjectiveName, new Point3D(obj.WorldPosX, obj.WorldPosY, obj.PosZ), 60001, 13000, FlagPickedUp, ObjectDropped, ObjectReset, null, 299, 299);
                    Region.AddObject(_flag, info.MapId);
                    AddTrackedObject(_flag);
                }

                else
                {
                    LoadScenarioObject(obj);
                }
            }

            ZoneMgr curZone = Region.GetZoneMgr(Info.MapId);

            Region.LoadCells((ushort)(curZone.Info.OffX + 8), (ushort)(curZone.Info.OffY + 8), 8);
        }
Beispiel #7
0
    void EndBattle()
    {
        if (state == BattleState.WON)
        {
            if (CapturePoint.currentCapturePoint.reward == BattleReward.Attack)
            {
                for (int i = 0; i < Heroes.count; i++)
                {
                    Heroes.getHero(i).attackDamage += 3;
                }
            }

            if (CapturePoint.currentCapturePoint.reward == BattleReward.Health)
            {
                for (int i = 0; i < Heroes.count; i++)
                {
                    Heroes.getHero(i).maxHP     += 10;
                    Heroes.getHero(i).currentHP += 10;
                }
            }
            Vault.addMoney(CapturePoint.getVictoryLoot());
            CapturePoint.currentCapturePoint.Victory();
        }
        else if (state == BattleState.FLED)
        {
            for (int i = 0; i < fighters.Length; i++)
            {
                fighters[i].currentHP = fighters[i].maxHP;
            }
        }
        else if (state == BattleState.LOST)
        {
            for (int i = 0; i < fighters.Length; i++)
            {
                fighters[i].currentHP = fighters[i].maxHP;
            }
            for (int i = 0; i < Heroes.count; i++)
            {
                Heroes.getHero(i).currentHP = (int)(Heroes.getHero(i).maxHP * 0.5);
            }

            Vault.addChances(-1);
            if (Vault.getChances() <= 0)
            {
                SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
            }
            FindObjectOfType <CheckpointManager>().Respawn();
        }
        FindObjectOfType <AudioManager>().Stop("Background2");
        FindObjectOfType <AudioManager>().Play("Background1");
        GameStatus.isMainLevelPaused = false;
        Heroes.ResetCooldowns();
        SceneManager.UnloadSceneAsync(CapturePoint.TBCScenePass);
    }
    void Death()
    {
        CapturePoint point = captureSpot.GetComponent <CapturePoint>();

        //point.zombiesInGame.Remove(this.gameObject);
        captureSpot.GetComponent <CapturePoint>().zombiesInGame.Remove(this.gameObject);
        dead = true;
        zombie.GetComponent <Renderer>().material = dissolveMat;

        StartCoroutine(DeathTimer());
        ChanceToSpawn();
    }
Beispiel #9
0
 public void OnCaptured(CapturePoint cp)
 {
     if (CurrentObjective && CurrentObjective.CapturePoint == cp) {
         CurrentObjective.gameObject.SetActive(false);
         if (CurrentObjective.next) {
             ActivateObjective(CurrentObjective.next);
         } else {
             CurrentObjective = null;
             print ("The defenders were overrun!");
         }
     }
 }
Beispiel #10
0
    public static CapturePoint newCapturePoint(Player player, int x, int y)
    {
        GameObject CaptureGO = GameObject.Instantiate(Board.Instance.CapturePointPrefab, Board.Instance.transform);

        CapturePoint capture = CaptureGO.GetComponent <CapturePoint>();


        var P1 = player == Player.Player1;

        capture.Setup(P1, x, y);

        return(capture);
    }
Beispiel #11
0
    private void CreateCapturePoint(CapturePoint capturePoint,
                                    FlagLocation[] flagLocations)
    {
        // create a capture point from a prefab
        var cpObject   = Instantiate(CapturePointPrefab);
        var controller = cpObject.GetComponent <CapturePointController>();

        controller.CapturePoint  = capturePoint;
        controller.FlagLocations = flagLocations;
        cpObject.tag             = "CapturePoint";
        // calling this starts the controller script
        cpObject.SetActive(true);
    }
Beispiel #12
0
    // Start is called before the first frame update
    void Start()
    {
        fighters = CapturePoint.getFighters();
        InitEnemyFighters();
        //heroes = Heroes.getHeroArray();
        vault = FindObjectOfType <Vault>();
        state = BattleState.START;
        GameStatus.isMainLevelPaused = true;
        StartCoroutine(SetupBattle());

        setBattleText("Defeat the <color=red> enemies </color>!", 2);
        FindObjectOfType <AudioManager>().Play("Background2");
    }
Beispiel #13
0
    void SetCapturePoint(CapturePoint point)
    {
        float      x = 2.0f;
        GameObject capturePoint;

        capturePoint = Instantiate(CapturePointPrefab, new Vector3(x * point.X, x * point.Z, x * point.Y), Quaternion.identity);
        capturePoint.gameObject.name = point.TextureName;
        foreach (Neighbour neighbour in point.Neighbours)
        {
            capturePoint = Instantiate(NeighbourCapturePointPrefab, new Vector3(x * neighbour.X, x * neighbour.Z, x * neighbour.Y), Quaternion.identity);
            capturePoint.gameObject.name = neighbour.TextureName;
        }
        SpawnSphereAroundPoint(point);
    }
Beispiel #14
0
 public void StartTheFight(Collider2D collision)
 {
     if (!loaded && !isCaptured && !isTBCopen())
     {
         fighterPass                    = fighters;
         victoryLootPass                = victoryLoot;
         TBCScenePass                   = TBCScene;
         currentCapturePoint            = this;
         GameTracking.fightsTotalCount += 1;
         loaded = true;
         attempts++;
         FindObjectOfType <AudioManager>().Stop("Background1");
         SceneManager.LoadScene(TBCScene, LoadSceneMode.Additive);
     }
 }
Beispiel #15
0
    void SpawnSphereAroundPoint(CapturePoint point)
    {
        float x       = 2.0f;
        var   texture = Resources.Load <Texture2D>("Textures/" + point.TextureName);

        Debug.Log("Assets/Resources/Textures/" + point.TextureName);
        MainCameraSphere = Instantiate(SpherePrefab, new Vector3(x * point.X, x * point.Z, x * point.Y), Quaternion.identity);
        float radius = (Mathf.Max(Mathf.Abs(max_x), Mathf.Abs(max_z)) + Mathf.Max(Mathf.Abs(min_x), Mathf.Abs(min_z))) * 10.0f;

        MainCameraSphere.transform.localScale = new Vector3(radius, radius, radius);
        MainCameraSphere.GetComponent <MeshRenderer>().material             = new Material(shader);
        MainCameraSphere.GetComponent <MeshRenderer>().material.mainTexture = texture;
        MainCameraSphere.gameObject.name = "The Promised Land";
        GameObject.Find("Main Camera").transform.position = new Vector3(x * point.X, x * point.Z + 1.5f, x * point.Y);
    }
Beispiel #16
0
 public void OnCaptured(CapturePoint cp)
 {
     if (CurrentObjective && CurrentObjective.CapturePoint == cp)
     {
         CurrentObjective.gameObject.SetActive(false);
         if (CurrentObjective.next)
         {
             ActivateObjective(CurrentObjective.next);
         }
         else
         {
             CurrentObjective = null;
             print("The defenders were overrun!");
         }
     }
 }
Beispiel #17
0
    public static CapturePoint newCapturePoint(Player player)
    {
        GameObject CaptureGO = GameObject.Instantiate(Board.Instance.CapturePointPrefab, Board.Instance.transform);

        CapturePoint capture = CaptureGO.GetComponent <CapturePoint>();


        var P1 = player == Player.Player1;



        capture.Setup(P1, !P1 ? 1 : Board.Instance.WIDTH - capture.Width - 1, P1 ? 1 : Board.Instance.HEIGHT - capture.Height - 1);


        return(capture);
    }
Beispiel #18
0
    /// <summary>
    /// Blue has captured the point
    /// </summary>
    public void AdvanceBlue()
    {
        if (!capture.IsPreviousTerminus())
        {
            capture.activePoint = false;
            capture.GetComponent <SpriteRenderer>().color = Color.black;

            capture = capture.previous;
            capture.GetComponent <SpriteRenderer>().color = Color.white;
            capture.activePoint = true;
            StartCoroutine(capture.AdvanceProgress());
        }
        else
        {
            // blue wins
            gc.GameOver(GameController.TeamColor.BLUE);
        }
    }
Beispiel #19
0
    /// <summary>
    /// Red has captured the point
    /// </summary>
    public void AdvanceRed()
    {
        if (!capture.IsNextTerminus())
        {
            capture.activePoint = false;
            capture.GetComponent <SpriteRenderer>().color = Color.black;

            capture = capture.next;
            capture.GetComponent <SpriteRenderer>().color = Color.white;
            capture.activePoint = true;
            StartCoroutine(capture.AdvanceProgress());
        }
        else
        {
            // red wins
            gc.GameOver(GameController.TeamColor.RED);
        }
    }
        public DoubleDominationScenario(Scenario_Info info, int tier)
            : base(info, tier)
        {
            //flags.Add(new Flag(RKF_1, "The Landing", 360109, 428854, 6433, 1024));

            foreach (Scenario_Object scenarioObject in info.ScenObjects)
            {
                if (scenarioObject.Type == "Capture Point")
                {
                    CapturePoint cPoint = new CapturePoint(scenarioObject, null, OnCapture);
                    _capturePoints.Add(cPoint);
                    Region.AddObject(cPoint, info.MapId);
                }

                else
                {
                    LoadScenarioObject(scenarioObject);
                }
            }
        }
Beispiel #21
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <PlayerController>() != null)
        {
            readyToAttack = true;
        }

        if (other.GetComponent <AIEnemy>() != null)
        {
            if (!currentAI.ContainsKey(other.GetComponent <AIEnemy>()))
            {
                AIEnemy newAI = other.GetComponent <AIEnemy>();
                currentAI.Add(newAI, newAI.tag);
            }
        }

        if (other.GetComponent <CapturePoint>() != null)
        {
            capturePoint = other.GetComponent <CapturePoint>();
        }
    }
        public void OnCapture(CapturePoint captured)
        {
            if (_capturePoints[0].OwningRealm == _capturePoints[1].OwningRealm && _capturePoints[0].OwningRealm != Realms.REALMS_REALM_NEUTRAL)
            {
                foreach (Object obj in Region.Objects)
                {
                    Player plr = obj as Player;
                    plr?.SendLocalizeString((_capturePoints[0].OwningRealm == Realms.REALMS_REALM_ORDER ? "Order" : "Destruction") + " will lock down both control points in 15 seconds!", ChatLogFilters.CHATLOGFILTERS_C_WHITE, Localized_text.CHAT_TAG_DEFAULT);
                }

                _capturePoints[0].CountdownTimerEnd = TCPManager.GetTimeStamp() + 15;
                _capturePoints[1].CountdownTimerEnd = TCPManager.GetTimeStamp() + 15;

                EvtInterface.AddEvent(Lockdown, 15000, 1);
                _pendingLockdown = true;
            }

            else
            {
                if (!_pendingLockdown)
                {
                    return;
                }
                EvtInterface.RemoveEvent(Lockdown);

                _capturePoints[0].CountdownTimerEnd = 0;
                _capturePoints[1].CountdownTimerEnd = 0;

                if (captured == _capturePoints[0])
                {
                    _capturePoints[1].BroadcastObjectiveInfo();
                }
                else
                {
                    _capturePoints[0].BroadcastObjectiveInfo();
                }

                _pendingLockdown = false;
            }
        }
Beispiel #23
0
 void Update()
 {
     if (Input.GetButtonDown("Fire2"))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit, 100))
         {
             if (hit.collider.gameObject.name == "The Promised Land")
             {
                 return;
             }
             GameObject   selectedCapturePoint = GameObject.Find(hit.collider.gameObject.name);
             CapturePoint cp = FindCapturePoint(selectedCapturePoint.gameObject.name);
             if (cp != null)
             {
                 doom();
                 SetCapturePoint(cp);
             }
         }
     }
 }
Beispiel #24
0
        public void OnCapture(CapturePoint captured)
        {
            Realms targetRealm = captured.OwningRealm;

            if (targetRealm == Realms.REALMS_REALM_NEUTRAL)
            {
                return;
            }

            GivePoints((int)captured.OwningRealm, 35);

            for (int i = 0; i < _capturePoints.Count; ++i)
            {
                if (_capturePoints[i].OwningRealm != targetRealm)
                {
                    SetTimerState(true);
                    return;
                }
            }

            Lockdown();
        }
Beispiel #25
0
        public static string ToCustomString(this CapturePoint capturePoint)
        {
            switch (capturePoint)
            {
            case CapturePoint.PointA:
                return("POINT_A");

            case CapturePoint.PointB:
                return("POINT_B");

            case CapturePoint.PointC:
                return("POINT_C");

            case CapturePoint.PointD:
                return("POINT_D");

            case CapturePoint.PointE:
                return("POINT_E");

            default:
                return(string.Empty);
            }
        }
Beispiel #26
0
    void Start()
    {
        StreamReader reader     = new StreamReader("Assets/Resources/JSONData/sampleJSON.json");
        string       jsonString = reader.ReadToEnd();

        reader.Close();
        root = JsonConvert.DeserializeObject <Root>(jsonString);
        foreach (CapturePoint point in root.CapturePoints)
        {
            if (point.X < min_x)
            {
                min_x = point.X;
            }
            if (point.Y < min_z)
            {
                min_z = point.Y;
            }
            if (point.X > max_x)
            {
                max_x = point.X;
            }
            if (point.Y > max_z)
            {
                max_z = point.Y;
            }
        }
        Debug.Log(min_x);
        Debug.Log(min_z);
        Debug.Log(max_x);
        Debug.Log(max_z);
        if (max_x != -Mathf.Infinity)          // to check that we have atlease one capture point
        {
            currentCapturePoint = root.CapturePoints[0];
            SetCapturePoint(currentCapturePoint);
        }
    }
Beispiel #27
0
    bool isPointClearForRed(GameObject squad)
    {
        bool isAtCapPoint = squad.GetComponent <NPCSquad>().listOfNPCs[0].GetComponent <NpcSimple>().IsAtCapturePoint;

        CapturePoint.CapturePointId capId = squad.GetComponent <NPCSquad>().capPointId;

        CapturePoint point = null;

        foreach (KeyValuePair <CapturePoint.CapturePointId, CapturePoint> cp in capturePointMap.GetComponent <CapturePointMap>().capturePoints)
        {
            if (cp.Key == capId)
            {
                point = cp.Value;
            }
        }

        if (isAtCapPoint && (point.GetComponent <CapturePoint>().bluePlayersInside != 0))
        {
            return(false);
        }


        return(true);
    }
Beispiel #28
0
 int CapturePointComparer(CapturePoint x, CapturePoint y)
 {
     return(x.captureIndex.CompareTo(y.captureIndex));
 }
Beispiel #29
0
    void DarkRift_MessageReceived(object sender, MessageReceivedEventArgs e)
    {
        using (Message message = e.GetMessage())
            using (DarkRiftReader reader = message.GetReader()) {
                if (OverallStateManager.Instance.OverallState == OverallState.IN_GAME)
                {
                    if (ClientGameManager.Instance.ClientState == GameStates.GAME_IN_PROGRESS ||
                        ClientGameManager.Instance.ClientState == GameStates.WAITING_FOR_PLAYERS)
                    {
                        //game is in progress
                        if (message.Tag == NetworkTags.EntityUpdate)
                        {
                            ClientEntityManager entityManager = ClientEntityManager.Instance;
                            while (reader.Position < reader.Length)
                            {
                                string entityId     = reader.ReadString();
                                string entityTypeId = reader.ReadString();
                                Entity entity       = entityManager.GetEntity(entityId);
                                if (entity == null)
                                {
                                    entity = entityManager.CreateEntity(entityTypeId);
                                    reader.ReadSerializableInto(ref entity);                             //must populate entity before registering since registration depends on entity data
                                    entityManager.RegisterEntity(entity);
                                }
                                else
                                {
                                    reader.ReadSerializableInto(ref entity);
                                }
                            }
                        }
                        else if (message.Tag == NetworkTags.PlayerEventUpdate)
                        {
                            ClientEntityManager entityManager = ClientEntityManager.Instance;
                            while (reader.Position < reader.Length)
                            {
                                string      playerEventId     = reader.ReadString();
                                string      playerEventTypeId = reader.ReadString();
                                PlayerEvent playerEvent       = entityManager.GetPlayerEvent(playerEventId);
                                if (playerEvent == null)
                                {
                                    playerEvent = entityManager.CreatePlayerEvent(playerEventTypeId);
                                    reader.ReadSerializableInto(ref playerEvent);                             //must populate event before registering since registration depends on event data
                                    entityManager.RegisterPlayerEvent(playerEvent);
                                }
                                else
                                {
                                    reader.ReadSerializableInto(ref playerEvent);
                                }
                            }
                        }
                        else if (message.Tag == NetworkTags.EntityDeath)
                        {
                            ClientEntityManager.Instance.HandleEntityDeath(reader.ReadString());
                        }
                        else if (message.Tag == NetworkTags.EntityDespawn)
                        {
                            ClientEntityManager.Instance.HandleEntityDespawn(reader.ReadString());
                        }
                        else if (message.Tag == NetworkTags.PlayerEventEnd)
                        {
                            ClientEntityManager.Instance.HandlePlayerEventEnd(reader.ReadString());
                        }
                        else if (message.Tag == NetworkTags.CapturePoint)
                        {
                            while (reader.Position < reader.Length)
                            {
                                CapturePoint capturePoint = ClientGameManager.Instance.CapturePoints[reader.ReadUInt16()];
                                reader.ReadSerializableInto(ref capturePoint);
                            }
                        }
                        else if (message.Tag == NetworkTags.GameState)
                        {
                            ClientGameManager.Instance.UpdateGameState(reader.ReadSerializable <GameState>(), reader.ReadBoolean());
                        }
                    }

                    if (message.Tag == NetworkTags.ChatMessage)
                    {
                        UIManager.Instance.AddChatMessage(ClientGameManager.Instance.GameState.GetPlayer(reader.ReadString()), reader.ReadString());
                    }
                    else if (message.Tag == NetworkTags.UnitList)
                    {
                        List <PlayerUnit> playerUnits = new List <PlayerUnit>();
                        while (reader.Position < reader.Length)
                        {
                            playerUnits.Add(reader.ReadSerializable <PlayerUnit>());
                        }
                        UIManager.Instance.OnUnitListReceived(playerUnits);
                    }
                    else if (message.Tag == NetworkTags.PlayerJoined)
                    {
                        ClientGameManager.Instance.OnPlayerJoined(reader.ReadSerializable <Player>());
                    }
                    else if (message.Tag == NetworkTags.PlayerLeft)
                    {
                        ClientGameManager.Instance.OnPlayerLeft(reader.ReadSerializable <Player>());
                    }
                }
                else if (OverallStateManager.Instance.OverallState != OverallState.IN_GAME)
                {
                    if (waitingToJoin)
                    {
                        if (message.Tag == NetworkTags.GameState)
                        {
                            waitingToJoin = false;
                            OverallStateManager.Instance.LoadGame(reader.ReadSerializable <GameState>(), reader.ReadBoolean());
                        }
                    }
                    else
                    {
                        if (message.Tag == NetworkTags.FullUnitList)
                        {
                            List <PlayerUnit> playerUnits = new List <PlayerUnit>();
                            while (reader.Position < reader.Length)
                            {
                                playerUnits.Add(reader.ReadSerializable <PlayerUnit>());
                            }
                            MainMenuManager.Instance.OnUnitListReceived(playerUnits);
                        }
                    }
                }

                if (message.Tag == NetworkTags.Connection)
                {
                    //Response to join request indicating if our matchmaking ticket was valid
                    if (reader.ReadBoolean())
                    {
                        IsConnectedToServer = true;
                        //Notify anyone interested that we've completed joining a server
                        Debug.Log("PlayFab: Ticket accepted by server, join completed.");
                        ServerJoinSuccess?.Invoke("PlayFab: Ticket accepted by server, join completed.");
                    }
                    else
                    {
                        Debug.LogError("PlayFab: Ticket rejected by server, disconnecting.");
                        ServerJoinFailure?.Invoke("PlayFab: Ticket rejected by server, disconnecting.");
                        client.Disconnect();
                    }
                }
            }
    }
Beispiel #30
0
 public void Setup()
 {
     MyBase = Base.newBase(this);
     MyCapturePoints.Add(CapturePoint.newCapturePoint(this));
     MyRobots.Add(Robot.newRobot(this));
 }
Beispiel #31
0
        public GameState()
        {
            this.BigText = new Label("Player 1 is out", Controller.FontController.GetFont("bigFont"));
            this.BigText.HorizontalAlign = HorizontalAlign.CENTER;
            this.BigText.Visable         = false;
            this.BigText.Width           = 1800;
            this.BigText.Height          = 1000;

            Controller.LayerController.AddLayer("bombLayer");
            FatBomb.state      = this;
            Vetbol.state       = this;
            CapturePoint.state = this;
            TiledSprite bg = new TiledSprite(2000, 2000);

            bg.LoadTexture("background");
            bg.Depth = 0f;

            tilemap = new Tilemap();
            tilemap.LoadMap("Content/testmap.tmx", 32, 32);
            this.AddChild(bg);
            this.AddChild(tilemap);

            this.players = new List <Vetbol>();

            playerSpawn = tilemap.RemoveTiles(7);
            int playerRespawn = rnd.Next(playerSpawn.Count);

            List <Tile> capturePointTiles = tilemap.RemoveTiles(3);

            foreach (Tile tile in capturePointTiles)
            {
                CapturePoint capturepoint = new CapturePoint();
                capturepoint.Position = tile.Position + (new Vector2(-27, -61));
                capturePoints.Add(capturepoint);
                AddChild(capturepoint);
            }

            NotUsedSpawnPoints = new List <Tile>();
            NotUsedSpawnPoints.AddRange(playerSpawn);


            for (int i = 0; i < Controller.Input.getPadStateList.Where(c => c.IsConnected).Count(); i++)
            {
                this.players.Add(new Vetbol((PlayerIndex)i));
            }

            for (int j = 0; j < players.Count; j++)
            {
                this.players[j].score    = playerStartScore;
                this.players[j].Position = this.getAvailablePosition();
                this.AddChild(this.players[j]);
            }
            lastPlayerAlive = players[0];

            this.BombPool = new Pool <FatBomb>(50, false, FatBomb.IsValid, this.NewBomb);

            soundEffectBomb = Controller.Content.Load <SoundEffect>("sounds/explode");

            this.AddChild(this.BigText);

            this.hud = new HUD(this.players, respawnTime);
            this.AddChild(hud);

            deadSound = Controller.Content.Load <SoundEffect>("sounds/dead");
            ECGsound  = Controller.Content.Load <SoundEffect>("sounds/ecg");
        }
Beispiel #32
0
        public GameState()
        {
            this.BigText = new Label("Player 1 is out", Controller.FontController.GetFont("bigFont"));
            this.BigText.HorizontalAlign = HorizontalAlign.CENTER;
            this.BigText.Visable = false;
            this.BigText.Width = 1800;
            this.BigText.Height = 1000;

            Controller.LayerController.AddLayer("bombLayer");
            FatBomb.state = this;
            Vetbol.state = this;
            CapturePoint.state = this;
            TiledSprite bg = new TiledSprite(2000, 2000);

            bg.LoadTexture("background");
            bg.Depth = 0f;

            tilemap = new Tilemap();
            tilemap.LoadMap("Content/testmap.tmx", 32, 32);
            this.AddChild(bg);
            this.AddChild(tilemap);

            this.players = new List<Vetbol>();

            playerSpawn = tilemap.RemoveTiles(7);
            int playerRespawn = rnd.Next(playerSpawn.Count);

            List<Tile> capturePointTiles = tilemap.RemoveTiles(3);
            foreach (Tile tile in capturePointTiles)
            {
                CapturePoint capturepoint = new CapturePoint();
                capturepoint.Position = tile.Position + ( new Vector2(-27, -61));
                capturePoints.Add(capturepoint);
                AddChild(capturepoint);
            }

            NotUsedSpawnPoints = new List<Tile>();
            NotUsedSpawnPoints.AddRange(playerSpawn);

            for (int i = 0; i < Controller.Input.getPadStateList.Where(c => c.IsConnected).Count(); i++)
            {
                this.players.Add(new Vetbol((PlayerIndex)i));
            }

            for (int j = 0; j < players.Count; j++)
            {
                this.players[j].score = playerStartScore;
                this.players[j].Position = this.getAvailablePosition();
                this.AddChild(this.players[j]);
            }
            lastPlayerAlive = players[0];

            this.BombPool = new Pool<FatBomb>(50, false, FatBomb.IsValid, this.NewBomb);

            soundEffectBomb = Controller.Content.Load<SoundEffect>("sounds/explode");

            this.AddChild(this.BigText);

            this.hud = new HUD(this.players, respawnTime);
            this.AddChild(hud);

            deadSound = Controller.Content.Load<SoundEffect>("sounds/dead");
            ECGsound = Controller.Content.Load<SoundEffect>("sounds/ecg");
        }