public override void execute() { GameScene gameScene = mReceiver as GameScene; if (gameScene.getSceneType() != GAME_SCENE_TYPE.GST_MAIN) { return; } MainScene mainScene = gameScene as MainScene; if (!mainScene.atProcedure(PROCEDURE_TYPE.PT_MAIN_ROOM_LIST)) { return; } MainSceneRoomList roomListProcedure = mainScene.getCurOrParentProcedure <MainSceneRoomList>(PROCEDURE_TYPE.PT_MAIN_ROOM_LIST); // 还未冷却请求CD,则不能请求 if (!roomListProcedure.canRequestRoomList()) { return; } clampMin(ref mCurPageIndex, 0); // 向服务器请求一页房间列表 CSRequestRoomList requestRoomList = mSocketManager.createPacket <CSRequestRoomList>(); requestRoomList.mMinIndex.mValue = (short)(mCurPageIndex * GameDefine.MAX_REQUEST_ROOM_COUNT); requestRoomList.mMaxIndex.mValue = (short)(requestRoomList.mMinIndex.mValue + GameDefine.MAX_REQUEST_ROOM_COUNT); mSocketManager.sendMessage(requestRoomList); }
public override void _Ready() { scene = GetNode <MainScene>("/root/Main"); audio = scene.GetNode <AudioManager>("AudioManager"); Points += ((int)MainScene.CurrentLevel) * Points; }
public override void Process(Entity entity) { // // ONLY piano key entities come here // MainGameScene = entity.Scene as MainScene; //hand entity belongs to MainScene SpriteRenderer sp = entity.GetComponent <SpriteRenderer>(); PlayingComponent pc = entity.GetComponent <PlayingComponent>(); if (pc.ChannelMsg.Command == ChannelCommand.NoteOn) { sp.Color = Color.Blue; } else { sp.Color = Color.White; } entity.RemoveComponent <PlayingComponent>(); if (PrevKey == null) { PrevKey = entity; return; } SpriteRenderer PrevSp = PrevKey.GetComponent <SpriteRenderer>(); PrevSp.Color = Color.White; PrevKey = entity; }
public void FlagPoleCreationTest() { var game = new GameObject("Mario"); ResourceManager.Instance.LoadSpriteSheetFromFile("sm-mario-sprites", @"resources\sm-mario-sprites.png", 10); ResourceManager.Instance.LoadFontFromFile("arial", @"resources\arial.ttf"); var s = new MainScene(game) { Name = "play" }; game.SceneManager.AddScene(s); var flagPole = new FlagPole(game); Assert.IsFalse(flagPole.HasUpwardVelocity, "Flag pole is moving upwards!"); Assert.IsFalse(flagPole.IgnoreAllCollisions, "Flag pole is uncollidable!"); Assert.IsFalse(flagPole.IgnorePlayerCollisions, "Flag pole is uncollidable by player!"); Assert.IsFalse(flagPole.IsJumping, "Flag pole is jumping!"); Assert.IsFalse(flagPole.IsMoving, "Flag pole is moving!"); Assert.IsFalse(flagPole.IsPlayer, "Flag pole is player!"); Assert.IsTrue(flagPole.IsStatic, "Flag pole is not static!"); Assert.IsTrue(flagPole.Visible, "Flag pole is invisible!"); Assert.IsTrue(flagPole.Acceleration == 0, "Flag pole is accelerating!"); Assert.IsTrue(flagPole.Velocity == 0, "Flag pole has non-zero velocity!"); Assert.IsFalse(flagPole.IsAffectedByGravity, "Flag pole shouldn't be affected by gravity until Mario touches it!"); }
/// <summary> /// 初始化场景 /// </summary> public override void Initialize() { isOnUpdate = false; sceneDic["MainScene"] = new MainScene(); sceneDic["BattleScene"] = new BattleScene(); }
/// <summary> /// 在实例化的同时进行基本参数的设置,调用在Start()之前 /// </summary> /// 作者:庄亦舟 void Awake() { totalHP = GameManager._maxHP; totalSP = GameManager._maxRage; tempPara = 0; _instance = this; }
public override void Initialize() { SetMainLight(fk_Material.TrueWhite, new fk_Vector(0, 0, -1)); SetStateLight(fk_Material.TrueWhite, new fk_Vector(0, 0, -1)); SetMainCamera(new fk_Vector(0, 0, 100)); SetStateCamera(new fk_Vector(0, 0, 100)); _titleTex = new fk_RectTexture(); if (!_titleTex.ReadJPG("sram.jpg")) { Console.WriteLine("Tex Load Error"); } _titleTex.TextureSize = new fk_TexCoord(40, 30); _titleTexModel = new fk_Model() { Shape = _titleTex, Material = fk_Material.White }; _titleTexModel.GlMoveTo(new fk_Vector(0, 10, 0)); MainScene.EntryModel(_titleTexModel); _guideSprite = new fk_SpriteModel(); if (!_guideSprite.InitFont("PixelMplus12-Regular.ttf")) { Console.WriteLine("Font Load Error."); } _guideSprite.PrdScale(0.2); _guideSprite.DrawText("Enter : Start"); _guideSprite.GlMoveTo(new fk_Vector(0, -20, 0)); MainScene.EntryModel(_guideSprite); base.Initialize(); }
public ChasingBehavior(MainScene scene, float chaseDist, float forgetDist, float spd) { this.Scene = scene; this.ChaseDist = chaseDist; this.ForgetDist = forgetDist; this.Spd = spd; }
public static void RunLoop() { while (IsExist is true) { //update time Time.Update(); SystemScene?.Update(Time.DeltaSeconds); MainScene?.Update(Time.DeltaSeconds); BehaviorSystems.ForEach((system) => UpdateBehaviorSystem(system)); if (EngineWindow != null && EngineWindow.IsExisted != false) { EngineWindow.Update(Time.DeltaSeconds); } if (EngineWindow != null && EngineWindow.IsExisted == false) { IsExist = false; } PresentRender.BeginDraw(); BehaviorSystems.ForEach((system) => system.Present(PresentRender)); PresentRender.EndDraw(false); } }
// ISCENECOMPONENT INTERFACE void ISceneComponent.Initialize(MainScene scene) { m_CharacterController = GetComponent <CharacterController>(); m_InputManager = scene.InputManager; m_InputManager.LockCursor(true); }
// Use this for initialization void Start() { if(GameObject.Find("MainScene")) mainScene = GameObject.Find("MainScene").GetComponent<MainScene>(); if (GameObject.Find("BedScene")) bedScene = GameObject.Find("BedScene").GetComponent<BedScene>(); }
public override void Process(Entity entity) { // // ONLY MOUSE entity comes here // MainGameScene = entity.Scene as MainScene; //hand entity belongs to MainScene CurrentMouse = Mouse.GetState(); MousePos = new Vector2(CurrentMouse.Position.X, CurrentMouse.Position.Y); entity.Transform.Position = Scene.Camera.ScreenToWorldPoint(new Vector2(CurrentMouse.Position.X, CurrentMouse.Position.Y)); MouseCollider = entity.GetComponent <BoxCollider>(); //did we click on a BoxCollider if (Input.LeftMouseButtonPressed) { if (MouseCollider.CollidesWithAny(out CollisionResult collisionResult)) { //KeyPressed = collisionResult.collider.entity; //Sprite sp = KeyPressed.GetComponent<SpriteRenderer>(); //sp.Color = Color.Blue; } } if (Input.LeftMouseButtonReleased) { //Sprite sp = KeyPressed.GetComponent<SpriteRenderer>(); //sp.Color = Color.White; } }
public override void Initialize() { base.Initialize(); MainScene.ClearModel(); StateScene.ClearModel(); SetMainLight(fk_Material.TrueWhite, new fk_Vector(0, 0, -1)); SetStateLight(fk_Material.TrueWhite, new fk_Vector(0, 0, -1)); SetMainCamera(new fk_Vector(0, 0, 100)); SetStateCamera(new fk_Vector(0, 0, 100)); InitializeBackground(); GameInfo.Create(); GameInfo.Refresh(); var player = new Player(new fk_Vector(0, 0, 20)); var boss = new Boss(new fk_Vector(0, 0, -40)); _stateDrawer = new StateDrawer(); _stateDrawer.InitSprites(); _stateDrawer.Entry(); }
void Start() { Glob = this; Scenes = new ScenesManager(); Scenes.Push(MainScene.GetInstance(this)); ZoomScale = 1f; }
internal void Update() { time.FrameCount++; frameTimer.FrameTime = (float)frameTimer.Stop() * .001f; frameTimer.Start(); time.Start(); vrSystem?.Update(); sEngine.Awake(); sEngine.Start(); pEngine.Scene2Body?.Invoke(); sEngine.Update(); iHandler.Update(); //mesh morpher if (task != null) { task(); task = null; } MainScene.Update(); animEngine.Upadate(frameTimer.FrameTime); gEngine.UIEngine.UpdateUI(); //physics #if PHYS pEngine.Update(frameTimer.FrameTime); #endif aEngine.Update(); sEngine.PreRender(); pEngine?.Body2Scene?.Invoke(); time.UpdateTime = time.Stop(); }
public override void _Ready() { NumSpawned++; stateMachine.Add(nameof(EmptyState), new EmptyState()); stateMachine.Add(nameof(EnemyMoveSteady), new EnemyMoveSteady(this, stateMachine, MoveSpeed)); stateMachine.Add(nameof(EnemyMoveUp), new EnemyMoveUp(this, stateMachine, MoveSpeed)); stateMachine.Add(nameof(CrazyMode), new CrazyMode(this, 4 * MoveSpeed)); stateMachine.ChangeState(nameof(EnemyMoveSteady)); BelowArea = GetNode <Area2D>("Area2D"); FollowNode = GetFollowingPoint(); SideChecker = new SideChecker(GetNode <Node2D>("SideChecker")); scene = GetNode <MainScene>("../.."); audio = scene.GetNode <AudioManager>("AudioManager"); animation = GetNode <AnimationPlayer>("AnimationPlayer"); triangle = GetNode <Sprite>("Triangle"); square = GetNode <Sprite>("Square"); folded = GetNode <Sprite>("Folded"); origami = GetNode <Sprite>("Origami"); animations = new Dictionary <string, Sprite>() { { nameof(triangle), triangle }, { nameof(square), square }, { nameof(folded), folded }, { nameof(origami), origami }, }; animations[EnemyType].Visible = true; animation.Play(EnemyType); PauseMode = PauseModeEnum.Stop; }
public void ChangeScene(eScene scene) { SceneBase change = null; switch (scene) { case eScene.None: break; case eScene.MainTown: change = new MainScene(); break; case eScene.Battle: break; default: break; } if (change != null) { SceneSwitch(change); } }
public override void execute() { GameScene gameScene = mReceiver as GameScene; if (gameScene.getSceneType() != GAME_SCENE_TYPE.GST_MAIN) { return; } MainScene mainScene = gameScene as MainScene; if (!mainScene.atProcedure(PROCEDURE_TYPE.PT_MAIN_ROOM_LIST)) { return; } MainSceneRoomList roomListProcedure = mainScene.getCurOrParentProcedure <MainSceneRoomList>(PROCEDURE_TYPE.PT_MAIN_ROOM_LIST); roomListProcedure.notifyRoomList(); // 通知房间系统获得了房间列表 mRoomSystem.clearRoomInfo(); int count = mRoomInfoList != null ? mRoomInfoList.Count : 0; for (int i = 0; i < count; ++i) { mRoomSystem.addRoomInfo(mRoomInfoList[i]); } // 通知界面显示房间列表 mScriptRoomList.showRoomList(mRoomSystem.getRoomInfoList(), roomListProcedure.getCurPage(), mAllRoomCount); }
public void SaveLevel(string name) { Log("Saving level"); string path = String.Format("Content/Data/{0}.json", name); MainScene.Save(path); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //ScreenPosition = new Vector2(200,200); graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.ApplyChanges(); scene1 = new MainScene(); bscene = new BattleScene(); EndScene escene = new EndScene(); bscene.game = this; scene1.Initialize(); bscene.Initialize(); sceneManager = new SceneManager(); sceneManager.scenes.Add(scene1); sceneManager.scenes.Add(bscene); sceneManager.scenes.Add(escene); sceneManager.currentScene = scene1; renderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None); renderTarget2 = new RenderTarget2D(graphics.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); base.Initialize(); }
public static void CreateDrop(Node context) { Drop drop = Instance("Drop") as Drop; drop.Position = new Vector2(300, 50); MainScene.AddChild(drop); }
public void Initialize() { starScene = new StartScene(); loginScene = new LoginScene(); mainScene = new MainScene(); battleScene = new BattleScene(); }
private void GameInitilaztion() { GameObject plane = new GameObject(); int size = 100; plane.AddComponent(new Entity(Terrain.GenerateTerrain(size), "")); plane.isStatic = true; plane.transform = new Transform(size / 2, 2, size / 2); plane.AddComponent(new RigidEntity(plane.transform.position)); MainScene.AddGameObject(plane); for (int i = 0; i < 100; i++) { GameObject obj = new GameObject(); obj.AddComponent(new Entity(Geometries.Cube, "")); obj.transform.position = new Vector3(Randomize.RangeFloat(1, 10), Randomize.RangeFloat(1, 10), Randomize.RangeFloat(1, 10)); obj.GetComponent <Entity>().model.shineDamper = 0.1f; obj.GetComponent <Entity>().model.reflectivity = 0.1f; obj.GetComponent <Entity>().model.luminosity = 0.8f; obj.AddComponent(new RigidEntity(obj.transform.position)); obj.AddComponent(new RaycastTarget(1, onClick: () => { obj.SetColour(Color.Red); lockToMouseObject = obj; }, onLoseFocus: () => { obj.SetColour(Color.White); if (lockToMouseObject == obj) { lockToMouseObject = null; } })); MainScene.AddGameObject(obj); } SunLight.gameObject.transform = new Transform(0, 25, 0, 0, 0, 0, 2f, 2f, 2f); SunLight.gameObject.AddComponent(new Entity(Geometries.Sphere)); SunLight.gameObject.GetComponent <Entity>().model.luminosity = 1; MainCamera.gameObject.transform = new Transform(0, 4, 10); float offset = 30; ProfilerScreen.AddComponent(new Sprite("grid")); ProfilerScreen.transform.localScale = new Vector3(0.6f, 0.2f, 0.5f); ProfilerScreen.transform.position = new Vector3(0, 7 + offset, 0); ProfilerScreen.GetComponent <Sprite>().UIConstriant = UIPosition.Left; MainScene.AddGameObject(ProfilerScreen); text1.AddComponent(new Text("FPS", font, 8)); text1.transform.position = new Vector3(0, -35 + offset, 0); text1.GetComponent <Text>().UIConstriant = UIPosition.Left; MainScene.AddGameObject(text1); text2.AddComponent(new Text("Memory", font, 8)); text2.transform.position = new Vector3(0, -43 + offset, 0); text2.GetComponent <Text>().UIConstriant = UIPosition.Left; MainScene.AddGameObject(text2); }
public override void _Ready() { scene = GetNode <MainScene>("/root/Main"); ballScene = GD.Load <PackedScene>("res://Resources/Ball/Ball.tscn"); base._Ready(); animation.Play("multi"); }
protected override void Initialize() { base.Initialize(); Nez.Scene.SetDefaultDesignResolution(1280, 720, Nez.Scene.SceneResolutionPolicy.ShowAll); Debug.Log(Screen.Size); Scene = new MainScene(); IsMouseVisible = false; }
private void OnTriggerStay(Collider other) { if (mainScene == null) if (GameObject.Find("MainScene")) mainScene = GameObject.Find("MainScene").GetComponent<MainScene>(); if (mainScene != null) mainScene.OnTriggerStayAtFinger(other, rightOrLeft); }
protected override void Initialize() { base.Initialize(); SQLManager.SetUpSQL(); Scene = new MainScene(); //Scene.Camera.ZoomOut(10f); Scene.Camera.SetPosition(new Vector2(17 * 64, 12 * 64)); }
// ISCENECOMPONENT INTERFACE void ISceneComponent.Initialize(MainScene scene) { m_HeadTransform = scene.PlayerController.HeadTransform; m_TerrainManager = scene.TerrainManager; m_InputManager = scene.InputManager; m_TerrainBlock.Initialize(m_TerrainManager.BlockSettings); UpdateSelectedBlock(true); }
public override void OnDestroy() { SceneManager.DontDestroyOnLoad(player.GameObject); scene = new MainScene(); SceneManager.Load(scene, LoadSceneMode.Single); MiutiObject miuti = MiutiObject.Create(false); SingleObject single = GameObject.CreateWith <SingleObject>(); }
void die() { if (this == Global.playerChar) { MainScene.gameover(); } GetComponent <Animator> ().Play("Attack"); gameObject.SetActive(false); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Util.Initialize(this); scene = new MainScene(); scene.Entities.Add(Entity.CreateEntity()); base.Initialize(); }
public override void OnAddedToEntity() { base.OnAddedToEntity(); _mainScene = (entity.scene as MainScene); PlayerKey = _mainScene.Players[PlayerId].Key; Core.schedule(BufferTime, true, QueryDatabase); }
// Use this for initialization void Start() { ms = GameObject.Find("MainScene").GetComponent <MainScene>(); kodomoNormal = Resources.Load("Prefabs/KodomoNormal") as GameObject; kodomoBycycle = Resources.Load("Prefabs/KodomoBycycle") as GameObject; Observable.Interval(TimeSpan.FromSeconds(spawnSpan)) .Where(_ => !ms.isGameOver) .Subscribe(_ => SpawnKodomoNormal()); }
public static IScene GetSceneByName(string name){ IScene scene = null; if(LOGINSCENE.Equals(name)){ scene = new LoginScene(); }else if(MAINSCENE.Equals(name)){ scene = new MainScene(); }else if(FORMATIONVIEW.Equals(name)){ scene = new FormationScene(); } return scene; }
public void InitByApp() { if (GameObject.Find("main")) { m_maineScene = GameObject.Find("main").GetComponent<MainScene>(); if (m_maineScene != null) { m_maineScene.RegisterLevel(this); } } }
private void OnTriggerEnter(Collider other) { if (mainScene == null) mainScene = GameObject.Find("MainScene").GetComponent<MainScene>(); mainScene.OnTriggerEnterAtCream(other); if (other.tag == "PlayerHead") { Destroy(this.gameObject); } if (other.tag == "Tongue") { Destroy(this.gameObject); } }
public AlienBuilding(WarGame game, Vector3 _position, MainScene _scene) : base(game, _scene, _position) { gameObjectModel = game.alienBaseModel; scale = new Vector3(0.5f, 0.5f, 0.5f); maxForce = 0; maxSpeed = 0; mass = 1000; currentSB = SBNames.None; currentWorld = Matrix.CreateScale(scale) * Matrix.CreateWorld(Position, lastNonZeroVelocity, Vector3.Up); boundingBox = new Bbox(this, game, scene); scene.SceneComponents.Add(boundingBox); boundingBox.RecalculateBoundingBox(); }
public ScreenManager(ContentManager content, GraphicsDeviceManager graphics) { // TODO: Construct any child components here serverHandler = new ServerHandler(); weather = new Weather(); mainScene = new MainScene(content, graphics); loadingScreen = new LoadingScreen(); mainMenu = new MainMenu(content.Load<SpriteFont>("Fonts\\menufont")); highScores = new HighScores(serverHandler); settingsMenu = new SettingsMenu(weather, this); pauseMenu = new PauseMenu(); deadScreen = new DeadScreen(this); weatherMenu = new WeatherMenu(this, weather); CurrentWeather = weather.WeatherForecast; }
void Start() { ms = FindObjectOfType<MainScene>(); anim = gameObject.GetComponent<Animator>(); startPos = transform.position; }
public void SetMainScene(MainScene in_scene) { m_mainScene = in_scene; }
protected override IEnumerator UnloadScene(MainScene scene, Action<float, string> progressDelegate) { this.Publish (new GameEndEvent ()); yield break; }