public override void ExitState() { GameEventModuel eventModuel = GameStart.GetInstance().EventModuel; eventModuel.UnRegisterEventListener(GameEventID.Reset_Game_State, HandleResetStateEvent); eventModuel.UnRegisterEventListener(GameEventID.ENTITY_HIT_BALL, HandleEntityHitBall); }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main(string[] args) { using (GameStart game = new GameStart()) { game.Run(); } }
public static void ExportFile(string path, Action <float> loading, Action <byte[], string> loaded) { var lowerPath = path.ToLower(); string apkPath = URLs.streamingAssetsPath + lowerPath; string savePath = URLs.persistentDataPath + lowerPath; Logger.Log("[ExportFile]" + apkPath + " " + savePath); instance.StartCoroutine(instance.LoadFileForm(apkPath, loading, (www, errorInfo) => { if (!string.IsNullOrEmpty(errorInfo)) { GameStart.Invoke(() => { loaded(null, errorInfo); }); return; } byte[] bytes = www.bytes; GameStart.Invoke(() => { if (bytes != null && bytes.Length != 0) { errorInfo = SaveFile(bytes, savePath, false); } loaded(bytes, errorInfo); }); })); }
public async Task ConnectAsync() { connection = new HubConnection(url); hubProxy = connection.CreateHubProxy("ChatHub"); hubProxy.On <User>("ParticipantLogin", (u) => ParticipantLoggedIn?.Invoke(u)); hubProxy.On <string>("ParticipantLogout", (n) => ParticipantLoggedOut?.Invoke(n)); hubProxy.On <string>("ParticipantDisconnection", (n) => ParticipantDisconnected?.Invoke(n)); hubProxy.On <string>("ParticipantReconnection", (n) => ParticipantReconnected?.Invoke(n)); hubProxy.On <string>("BroadcastGameStart", (n) => GameStart?.Invoke(n, MessageType.Broadcast)); hubProxy.On <string>("BroadcastGameEnd", (n) => GameEnd?.Invoke(n, MessageType.Broadcast)); hubProxy.On <string, string>("BroadcastSetHost", (n, m) => SetNewHost?.Invoke(n, m, MessageType.Broadcast)); hubProxy.On <string, string>("BroadcastTextMessage", (n, m) => NewTextMessage?.Invoke(n, m, MessageType.Broadcast)); hubProxy.On <string, byte[]>("BroadcastPictureMessage", (n, m) => NewImageMessage?.Invoke(n, m, MessageType.Broadcast)); hubProxy.On <string, byte[]>("BroadcastStrokes", (n, m) => NewStrokesCollected?.Invoke(n, m, MessageType.Broadcast)); hubProxy.On <string, string>("BraodcastAnswerIsRight", (n, m) => Correct?.Invoke(n, m)); hubProxy.On <string, string>("UnicastTextMessage", (n, m) => NewTextMessage?.Invoke(n, m, MessageType.Unicast)); hubProxy.On <string, byte[]>("UnicastPictureMessage", (n, m) => NewImageMessage?.Invoke(n, m, MessageType.Unicast)); hubProxy.On <string>("ParticipantTyping", (p) => ParticipantTyping?.Invoke(p)); connection.Reconnecting += Reconnecting; connection.Reconnected += Reconnected; connection.Closed += Disconnected; ServicePointManager.DefaultConnectionLimit = 10; await connection.Start(); }
public void Initialize() { gameOverPosition.X = 320; gameOverPosition.Y = 130; device = graphics.GraphicsDevice; gameState = new GameState(); gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight); board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight)); darwin = new Darwin(board); zTime = new ZombieTime(board); nurseryOne = new Nursery(board, darwin); nurseryTwo = new Nursery(board, darwin); fatBossZombie = new FatBossZombie(15, 4, 19, 14, 4, 3, darwin, board); fatBossZombie.resetGapeMode(); stairs = new Stairs(board); walls = setWallsInLevelSix(); setLevelState(); gameState.setState(GameState.state.Start); }
private void FreshUI() { GameDataModuel dataModuel = GameStart.GetInstance().DataModuel; FreshHeart(dataModuel.m_heart); FreshNum(dataModuel.m_hitCount); }
void Awake() { instance = this; Screen.sleepTimeout = SleepTimeout.NeverSleep; GameObject uiGo = GameObject.Find("UI").gameObject; GameObject.DontDestroyOnLoad(uiGo); GameObject setupUIGo = uiGo.transform.Find("Canvas/SetupUI").gameObject; setupUIGo.AddComponent <SetupUI>(); setupUIGo.SetActive(true); GameObject msgUIGo = uiGo.transform.Find("Canvas/MessageNoticeUI").gameObject; msgUIGo.SetActive(true); msgUIGo.AddComponent <MessageNoticeUI>(); #if UNITY_STANDALONE || UNITY_EDITOR || UNITY_WEBPLAYER StandaloneInputModule inputModule = GameObject.Find("EventSystem").GetComponent <StandaloneInputModule>(); inputModule.forceModuleActive = true; #endif Application.targetFrameRate = 30; InitEnvironment(); }
public void Init(bool started) { active = new List <GameObject>(); GameObject go; go = Instantiate(zombie) as GameObject; go.transform.position = new Vector3(7.63f, 0, -10.55f); go.transform.SetParent(transform); go.transform.tag = "Zombie"; active.Add(go); paused = false; gs = GameObject.FindGameObjectWithTag("Canvas").GetComponent <GameStart>(); control = GameObject.FindGameObjectWithTag("Zombie").GetComponent <CharacterController>(); mobsource.Play(); mobsource.volume = 0.05f; pause.onClick.AddListener(TaskOnClickPause); //GameOverImage = GameObject.Find("GameOverImage").GetComponent<GameObject>(); score = 0; heartcount = 3; dead = false; runspeed = fixedrunspeed; totalspeed = fixedrunspeed; canvas = GameObject.FindGameObjectWithTag("Canvas").transform; activeHearts = new List <GameObject>(); for (int i = 0; i < 3; i++) { go = Instantiate(hearts[i]) as GameObject; go.transform.position = new Vector3(153 + (i * 90), -57, 0); go.transform.SetParent(canvas, false); activeHearts.Add(go); } cc = GameObject.FindGameObjectWithTag("Zombie").GetComponent <CollisionControl>(); cc.Init(true); begin = true; }
void CheckDllVersion() { //iphone 依然有dll版本,dll版本为基包值。 _serverDLLVersion = GetDLLVersion(_serverRootXML); Logger.Log("[CheckDllVersion] version local:" + _localDLLVersion + " vs server:" + _serverDLLVersion); if (_serverDLLVersion <= _localDLLVersion) { GameStart.Invoke(LoadLocalDLL); return; } Action <string> downloadResult = (error) => { if (string.IsNullOrEmpty(error)) { SetDLLVersion(_localRootXML, _serverDLLVersion); SaveLocalRootXML(); _localDLLVersion = _serverDLLVersion; GameStart.Invoke(LoadLocalDLL); } }; Action downloadDll = () => { var t = new Thread(LogIpAddressAndMobileIP); t.Start(); string fileName = _serverRootXML.SelectSingleNode("/root/Version").Attributes["dllurl"].Value; DownloadFileFromServer(_serverDLLVersion, fileName, DLLLoaclPath, downloadResult); }; GameStart.Invoke(downloadDll); }
void GetNewestMD5Version() { _serverMD5Version = GetMD5Version(_serverRootXML); Logger.Log("[CheckMD5Version] version local:" + _localMD5Version + " vs server:" + _serverMD5Version); if (_serverMD5Version == _localMD5Version && File.Exists(ServerMD5ZipFilePath)) { GameStart.Invoke(CheckDllVersion); return; } Action <string> downloadResult = (error) => { if (string.IsNullOrEmpty(error)) { if (File.Exists(ServerMD5FilePath)) { File.Delete(ServerMD5FilePath); } SetMD5Version(_localRootXML, _serverMD5Version); SaveLocalRootXML(); _localMD5Version = _serverMD5Version; GameStart.Invoke(CheckDllVersion); } }; Action downloadDll = () => { string fileName = _serverRootXML.SelectSingleNode("/root/Version").Attributes["md5url"].Value; DownloadFileFromServer(_serverMD5Version, fileName, ServerMD5ZipFilePath, downloadResult); }; GameStart.Invoke(downloadDll); }
void LoadStreamingDllAndEnterGame() { SetupUI.instance.SetHint("LoadStreamingDllAndEnterGame"); var streamingDllPath = URLs.streamingAssetsPath + DLLFileName; Logger.Error("LoadStreamingDllAndEnterGame:" + URLs.FILE_PROTOCOL + streamingDllPath); StartCoroutine(LoadFileForm(URLs.FILE_PROTOCOL + streamingDllPath, (p) => { SetupUI.instance.SetHint("LoadStreamingDllAndEnterGame:" + p); }, (www, errorInfo) => { Logger.Log("LoadStreamingDllAndEnterGame final"); if (!string.IsNullOrEmpty(errorInfo)) { Logger.Error("LoadStreamingDll Error " + errorInfo); return; } SetupUI.instance.SetHint("UnLoadDLL:"); //Logger.Assert(www != null, "download file bytes empty error:" + errorInfo); byte[] dllData = www.assetBundle.LoadAllAssets <TextAsset>()[0].bytes; www.assetBundle.Unload(false); Action enter = () => { SetupUI.instance.SetHint("GetTypeFromAssembly:"); Type t = GetTypeFromAssembly(dllData); EnterGame(t); }; GameStart.Invoke(enter); })); }
void LoadLocalDLL() { Logger.Log("LoadLocalDLL " + DLLLoaclPath); Type t; if (ApplicationEx.platform == RuntimePlatform.WindowsEditor || ApplicationEx.platform == RuntimePlatform.IPhonePlayer) { t = GetTypeFromAssembly(); Logger.Log("WindowsEditor Temp "); EnterGame(t); return; } SetupUI.instance.SetHint("载入资源中"); StartCoroutine(LoadFileForm(URLs.FILE_PROTOCOL + DLLLoaclPath, (p) => { }, (www, errorInfo) => { if (!string.IsNullOrEmpty(errorInfo)) { Logger.Error("LoadLocalDLL Error " + errorInfo); return; } //Logger.Assert(www != null, "download file bytes empty error:" + errorInfo); byte[] dllData = www.assetBundle.LoadAllAssets <TextAsset>()[0].bytes; www.assetBundle.Unload(false); Action enter = () => { t = GetTypeFromAssembly(dllData); EnterGame(t); }; GameStart.Invoke(enter); })); }
public override void EnterState() { m_startUI = GameStart.GetInstance().UIModuel.LoadResUI <GameStartUI>("StartUI"); GameAudioModuel moduel = GameStart.GetInstance().AudioModuel; moduel.PlayBgAudio("BGM_001"); }
private void DownloadDllAndEnterGame() { _serverDLLVersion = GetDLLVersion(_serverRootXML); Action <WWW, string> downloadResult = (www, error) => { if (!string.IsNullOrEmpty(error)) { Logger.Error("Download Dll Error " + error); return; } //Logger.Assert(www != null, "download file bytes empty error:" + error); byte[] dllData = www.bytes; Action enter = () => { Type t = GetTypeFromAssembly(dllData); EnterGame(t); }; GameStart.Invoke(enter); }; Action downloadDll = () => { string fileName = _serverRootXML.SelectSingleNode("/root/Version").Attributes["url"].Value; StartCoroutine(LoadFileForm(DownloadMgr.Instance.GetRandomParasUrl(fileName), null, downloadResult)); }; GameStart.Invoke(downloadDll); }
private void OnRecvChangeScene(IChannel channel, Message message) { SChangeScene msg = message as SChangeScene; GameStart startup = GameObject.FindObjectOfType <GameStart>(); startup.PlayerEnter(msg.level); }
void StartHotUpdate() { GetApkRootCfg(() => { GameStart.Invoke(FirstExport); }); }
private void GameBallOutofRange(GameBall ball) { Vector3 position = m_gameBall.GetPosition(); if (position.y > 0) { m_contestData.AddHeart(); m_aiIndex = 0; } else { m_contestData.ReduceHeart(); m_playerIndex = 0; } if (m_contestData != null && !m_contestData.m_changeAudio && m_change) { // GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; // audioModuel.StopAudio(); } m_contestUI.FreshUI(m_contestData.m_heart, m_contestData.m_index); m_gameBall.ResetVelocity(); m_gameBall.SetPosition(m_ground.GroundData.GetFireBallPoint(ESide.Player)); m_aiController.SwitchState(EAIControlState.BackToBornPoint); if (m_contestData.m_heart < 0) { m_player.SetIdle(); m_contestUI.GameEnd(); m_aiController.gameObject.SetActive(false); GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; audioModuel.PlayAudio("lose"); } }
private void GetApkRootCfg(Action callback) { Logger.Log("GetApkRootCfg: " + APKRootCfgPath); StartCoroutine(LoadFileForm(APKRootCfgPath, (p) => { }, (www, errorInfo) => { if (www == null || !string.IsNullOrEmpty(errorInfo)) { Logger.Error("get ApkRootCfg file empty error:" + errorInfo); PluginMsgAction.Instance.ShowMsgBox("ApkRootCfg :" + errorInfo, "重试", "退出", () => { PluginMsgAction.Instance.HideMsgBox(); Logger.Log("get ApkRootCfg file retry"); GameStart.Invoke(StartHotUpdate); }, () => { Application.Quit(); }); return; } string content = Encoding.Default.GetString(www.bytes); _apkRootXML.LoadXml(content); GameStart.Invoke(callback); })); }
public virtual void Start() { loginUI = GetComponent <LoginUI>(); lobby = GetComponent <LobbyUI>(); gameStart = GetComponent <GameStart>(); PhotonEngine.Instance.AddEvent(this); }
public static void GameOver() { string gameOverLogo = $@" _____ ____ / ___/__ ___ _ ___ / __ \_ _____ ____ / (_ / _ `/ ' \/ -_) / /_/ / |/ / -_) __/ \___/\_,_/_/_/_/\__/ \____/|___/\__/_/ Your pet died,type 1 if you like to play again. "; Console.WriteLine(gameOverLogo); var finalChoice = Console.ReadLine(); switch (finalChoice) { case "1": GameStart.GameStartNow(); break; default: Console.WriteLine(" BYE"); break; } }
private void GameBallOutofRange(BombBall ball) { m_start = false; Vector3 position = m_bombBall.GetPosition(); if (position.y > 0) { //m_contestData.AddHeart(); m_aiIndex = 0; m_aiBombTime += 2f; } else { //m_contestData.ReduceHeart(); m_playerIndex = 0; m_playerBombTime += 2f; } if (m_contestData != null && !m_contestData.m_changeAudio && m_change) { GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; audioModuel.StopAudio(); } m_bombBall.ResetVelocity(); m_bombBall.SetPosition(m_ground.GroundData.GetFireBallPoint(ESide.Player)); m_aiController.SwitchState(EAIControlState.BackToBornPoint); // if (m_contestData.m_heart < 0) // { // m_player.SetIdle(); // m_aiController.gameObject.SetActive(false); // } }
public static void UnSubscribePerLevelEvents() { GameStart.UnSubscribeAll(); PlayerSpawn.UnSubscribeAll(); PlayerDead.UnSubscribeAll(); GameQuit.UnSubscribeAll(); }
private void OnDisable() { GameEventModuel eventModuel = GameStart.GetInstance().EventModuel; eventModuel.UnRegisterEventListener(GameEventID.ENTITY_HIT_BALL, HandleEntityHitBallMessage); eventModuel.UnRegisterEventListener(GameEventID.AI_HIT_BALL, HandleAIHitBallMessage); }
public override void EnterState() { GameObject ground = GameStart.GetInstance().ResModuel.LoadResources <GameObject>(EResourceType.Ground, "Ground"); ground = CommonFunc.Instantiate(ground); m_ground = CommonFunc.AddSingleComponent <Ground>(ground); GroundData groundData = new GroundData(); m_ground.InitGround(groundData); PlayerData playerData = new PlayerData(); m_palyer = new Player(1, playerData); m_palyer.InitPlayerAction(HitBallDelegate); GameObject go = new GameObject("Controller"); m_playerController = go.AddComponent <PlayerController>(); m_playerController.InitController(m_palyer); BallMechineData mechineData = new BallMechineData(); BallData ballData = new BallData(); m_ballMechine = new BallMechine(mechineData, ballData, m_ground.GetLeftPoint(), m_ground.GetRightPoint()); CoroutineTool.GetInstance().StartGameCoroutine(StartCoroutine()); }
void Start() { sGame = this; //download = gameObject.AddComponent<Download>(); //download.func = onDownload; onDownload(); }
public override void UnRegisterEvent() { base.UnRegisterEvent(); GameEventModuel eveModuel = GameStart.GetInstance().EventModuel; eveModuel.UnRegisterEventListener(GameEventID.PLAYER_HIT_BALL, HandlePlayerHitBallEvent); }
/// <summary> /// Handles the <see cref="GameStart" /> event. /// </summary> private static void GameStartHandler() { if (Game.Mode != GameMode.Running) { return; } Game.OnStart -= GameStartHandler; Game.OnUpdate -= GameStartHandler; //Call the Bootstrapper Bootstrap.Load(); var invocationList = GameStart?.GetInvocationList(); if (invocationList == null) { return; } foreach (var del in invocationList) { try { del.DynamicInvoke(); } catch (Exception e) { Console.WriteLine(e); } } }
public Player(int id, PlayerData playerData) { if (playerData == null) { return; } m_playerData = playerData; m_id = id; GameResModuel resModuel = GameStart.GetInstance().ResModuel; GameObject player = resModuel.LoadResources <GameObject>(EResourceType.Role, playerData.m_playerResPath); player = CommonFunc.Instantiate(player); if (player != null) { player.name = playerData.m_playerName; m_avatar = player.AddComponent <PlayerAvatar>(); m_anim = new PlayerAnim(player); m_anim.InitAnimator(playerData.m_animControllerName); GameObject collider = CommonFunc.GetChild(player, "Collider"); m_collider = new PlayerCollider(playerData.m_moveArea, playerData.m_radius, playerData.m_angle, collider.GetComponent <BoxCollider2D>()); MovePosition(m_playerData.m_bornPosition); } }
private void HandleBallHitEvent(GameEvent eve) { Debug.LogError("HandleBallHitEvent"); GameEventModuel eventModuel = GameStart.GetInstance().EventModuel; eventModuel.SendEvent(GameEventID.AI_SWITCH_STATE, true, 0f, EAIStateType.GotoHitTarget); }
private void OnRecvPlayerEnter(IChannel channel, Message message) { SPlayerEnter msg = message as SPlayerEnter; switch (msg.status) { case SPlayerEnter.Status.Fail: Debug.Log("Login fail"); Debug.Log(string.Format("name:{0} token:{1} scene:{2} status:{3}", msg.user, msg.token, msg.scene, msg.status)); MessageBox.Show("Username doesn't exists or wrong password."); return; case SPlayerEnter.Status.Error: MessageBox.Show("Login Error."); return; } MyNetwork network = GameObject.FindObjectOfType <MyNetwork>(); GameStart startup = GameObject.FindObjectOfType <GameStart>(); if (network.gameScene) {// ignore enter scene message when debug mode return; } //Console.WriteLine("Receive Enter..."); World.Instance.selfId = msg.id; startup.PlayerEnter(msg.scene); }
public void BounceLine(string name) { Animator animator = null; if (name == m_leftLine.name) { animator = m_leftLine; } else if (name == m_rightLine.name) { animator = m_rightLine; } GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; if (animator != null) { animator.enabled = true; animator.Play("LineAnim"); audioModuel.PlayAudio("hit_002"); } else { audioModuel.PlayAudio("hit_001"); } }
public void Init() { gameStart = FindObjectOfType<GameStart>(); for (int i = 0; i < playerPanels.Length; i++) { // pass self to panels playerPanels[i].SetDelegator(this); } ListenForPanelDropouts(); init = true; }
public void OnGameStart(ServerGame game, ServerClient opponent) { _Opponent = opponent; GameStart start = new GameStart(game.GameConfiguration, PlayerState.GetBaseArmy(), Opponent.PlayerState.GetBaseArmy(), Opponent.Name, PlayerState.ReinforcementPoints); QueueMessage(new ServerToClientMessage(start)); }
public void Initialize() { gameOverPosition.X = 320; gameOverPosition.Y = 130; device = graphics.GraphicsDevice; gameState = new GameState(); gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight); gameState.setState(GameState.state.Start); board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight)); darwin = new Darwin(board); //firstZombie = new Zombie(10, 10, 15, 5, 15, 5, board); //secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board); //thirdZombie = new Zombie(12, 10, 15, 5, 15, 5, board); Vector2[] myPath = new Vector2[4]; myPath[0] = new Vector2(8, 4); myPath[1] = new Vector2(8, 19); myPath[2] = new Vector2(25, 19); myPath[3] = new Vector2(25, 4); leaderZombie = new CongaLeaderZombie(8, 4, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath, darwin, board); followerZombies = new List<CongaFollowerZombie>(); // all conga paths for the different conga zombies are created here along with all conga zombies myPath = new Vector2[8]; myPath[0] = new Vector2(8,4); myPath[1] = new Vector2(8, 12); myPath[2] = new Vector2(8,19); myPath[3] = new Vector2(17, 19); myPath[4] = new Vector2(25,19); myPath[5] = new Vector2(25, 12); myPath[6] = new Vector2(25,4); myPath[7] = new Vector2(17, 4); followerZombies.Add(new CongaFollowerZombie(10,4,board.getNumSquaresX(),0,board.getNumSquaresY(),0,myPath,leaderZombie,darwin,board)); followerZombies.Add(new CongaFollowerZombie(12, 4, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath, leaderZombie,darwin, board)); followerZombies.Add(new CongaFollowerZombie(14, 4, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath, leaderZombie,darwin, board)); myPath = new Vector2[8]; myPath[2] = new Vector2(8, 4); myPath[3] = new Vector2(8, 12); myPath[4] = new Vector2(8, 19); myPath[5] = new Vector2(17, 19); myPath[6] = new Vector2(25, 19); myPath[7] = new Vector2(25, 12); myPath[0] = new Vector2(25, 4); myPath[1] = new Vector2(17, 4); followerZombies.Add(new CongaFollowerZombie(25, 8, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(25, 10, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(25, 14, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); myPath = new Vector2[8]; myPath[4] = new Vector2(8, 4); myPath[5] = new Vector2(8, 12); myPath[6] = new Vector2(8, 19); myPath[7] = new Vector2(17, 19); myPath[0] = new Vector2(25, 19); myPath[1] = new Vector2(25, 12); myPath[2] = new Vector2(25, 4); myPath[3] = new Vector2(17, 4); followerZombies.Add(new CongaFollowerZombie(22, 19, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(16, 19, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(14, 19, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); myPath = new Vector2[8]; myPath[6] = new Vector2(8, 4); myPath[7] = new Vector2(8, 12); myPath[0] = new Vector2(8, 19); myPath[1] = new Vector2(17, 19); myPath[2] = new Vector2(25, 19); myPath[3] = new Vector2(25, 12); myPath[4] = new Vector2(25, 4); myPath[5] = new Vector2(17, 4); followerZombies.Add(new CongaFollowerZombie(8, 12, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(8, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); myPath = new Vector2[8]; myPath[3] = new Vector2(8, 4); myPath[4] = new Vector2(8, 12); myPath[5] = new Vector2(8, 19); myPath[6] = new Vector2(17, 19); myPath[7] = new Vector2(25, 19); myPath[0] = new Vector2(25, 16); myPath[1] = new Vector2(25, 4); myPath[2] = new Vector2(17, 4); followerZombies.Add(new CongaFollowerZombie(29, 17, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(29, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(29, 16, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(29, 13, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); myPath = new Vector2[8]; myPath[7] = new Vector2(8, 4); myPath[0] = new Vector2(8, 7); myPath[1] = new Vector2(8, 19); myPath[2] = new Vector2(17, 19); myPath[3] = new Vector2(25, 19); myPath[4] = new Vector2(25, 12); myPath[5] = new Vector2(25, 4); myPath[6] = new Vector2(17, 4); followerZombies.Add(new CongaFollowerZombie(4, 7, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(4, 9, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(4, 8, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); followerZombies.Add(new CongaFollowerZombie(4, 10, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board)); leaderZombie.setFollowers(followerZombies); String zombieString = "This a zombie,\n don't near him \nas a human!!"; zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString); String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions"; darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString); String switchString = "This is a switch\n face it and press A\n to see what happens!!"; switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString); stairs = new Stairs(board); BasicObject[] removableWalls = setRemovableWallsSwitchOne(); BasicObject switchSquare = new BasicObject(board); switchSquare.X = 31; switchSquare.Y = 8; firstSwitch = new Switch(switchSquare, board, removableWalls); BasicObject[] removableWalls2 = setRemovableWallsSwitchTwo(); BasicObject switchSquare2 = new BasicObject(board); switchSquare2.X = 1; switchSquare2.Y = 15; secondSwitch = new Switch(switchSquare2, board, removableWalls2); // Initial starting position darwin.setGridPosition(16, 22); if (board.isGridPositionOpen(darwin)) { board.setGridPositionOccupied(darwin.X, darwin.Y); darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y); } // Darwin's lag movement counterReady = counter = 5; if (board.isGridPositionOpen(16, 1)) { stairs.setGridPosition(16, 1); stairs.setDestination(board.getPosition(16, 1)); } zTime = new ZombieTime(board); zTimeReset = new ZombieTime(board); setPotionPosition(28, 7); setPotion2Position(1, 7); setWallsInLevelFour(); setDanceFloor(); }
public Map(GameStart game) : base(game) { this.Game = game; }
public void Initialize() { gameOverPosition.X = 320; gameOverPosition.Y = 130; device = graphics.GraphicsDevice; gameState = new GameState(); gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight); gameState.setState(GameState.state.Level); board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight)); darwin = new Darwin(board); String zombieString = "This a zombie,\n don't near him \nas a human!!"; zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString); String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions"; darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString); stairs = new Stairs(board); if (board.isGridPositionOpen(5, 18)) { stairs.setGridPosition(5, 18); } // Initial starting position darwin.setGridPosition(6, 18); if (board.isGridPositionOpen(darwin)) { board.setGridPositionOccupied(darwin.X, darwin.Y); darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y); } // Darwin's lag movement counterReady = counter = 5; zTime = new ZombieTime(board); zTimeReset = new ZombieTime(board); setPotionPosition(27, 5); setBoxes(); setBoxPattern(); pattern = new BoxPattern(board, spotsForPattern); setVortexes(); setWalls(); snake = new Snake(10, 9, 27, 5, 18, 5, board); snake2 = new Snake(8, 15, 27, 5, 18, 5, board); snake3 = new Snake(21, 9, 27, 5, 18, 5, board); snake4 = new Snake(21, 15, 27, 5, 18, 5, board); northZombie = new PyroZombie(15, 3, 25, 4, 3, 3, board); northZombie.setGridPosition(15, 3); northZombie.setCurrentPatrolPoint(new Vector2(27, 3)); northZombie.setNextPatrolPoint(new Vector2(5, 3)); southZombie = new PyroZombie(15, 20, 25, 4, 20, 20, board); southZombie.setGridPosition(15, 20); southZombie.setCurrentPatrolPoint(new Vector2(5, 20)); southZombie.setNextPatrolPoint(new Vector2(27, 20)); eastZombie = new PyroZombie(29, 11, 29, 29, 19, 4, board); eastZombie.setGridPosition(29, 11); eastZombie.setCurrentPatrolPoint(new Vector2(29, 17)); eastZombie.setNextPatrolPoint(new Vector2(29, 6)); westZombie = new PyroZombie(3, 11, 3, 3, 19, 4, board); westZombie.setGridPosition(3, 11); westZombie.setCurrentPatrolPoint(new Vector2(3, 5)); westZombie.setNextPatrolPoint(new Vector2(3, 18)); flames = new LinkedList<Flame>(); }