public override void StartTouch(SceneControl.TouchEvent args) { // Now, what have we targeted from this click (if anything) Ray r = Camera.main.ScreenPointToRay (args.currentPosition); RaycastHit r_hit; // DID we point to anything from the touch? if (Physics.Raycast (r, out r_hit, Mathf.Infinity)) { GameObject zai = globalEvents.manaControllerService.RequestBuyZombie(r_hit.point, new Quaternion()); if (zai != null) { zombieAI ai = zai.GetComponent<zombieAI>(); if (ai != null) { ai.Start (); } if (zombieAppearanceEffect != null) { GameObject go = Instantiate( zombieAppearanceEffect, r_hit.point, Quaternion.Euler(-90.0f, 0.0f, 0.0f) ) as GameObject; Destroy(go, go.GetComponent<ParticleSystem>().duration); } } } }
public override void EndTouch(SceneControl.TouchEvent args) { if (cancelled || !firstMovementComplete) return; // End of the touch. Perform the influence now. Collider[] objs = Physics.OverlapSphere( firstTouchPosition, 12.0f ); foreach( Collider obj in objs) { commonAI gameObj = obj.GetComponent<commonAI>(); if (gameObj != null && gameObj.enabled) { ICanBeInfluenced inf = gameObj as ICanBeInfluenced; if (inf != null) { //Debug.Log ("Found object: " + obj.name); inf.BeInfluenced(firstDirection); continue; } } StateMachineDriver statemachine = obj.GetComponent<StateMachineDriver>(); if (statemachine != null && statemachine.enabled) { statemachine.AddAction("influence", firstDirection); continue; } } }
public override void PosDrawPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, SceneControl.RenderHelper render, Cameras.ICamera cam, IList<Light.ILight> lights) { SimpleTree tree = (obj.Modelo as TreeModel).Tree; tree.DrawLeaves(obj.WorldMatrix, cam.View, cam.Projection, false); render.ResyncStates(); render.SetSamplerStates(ginfo.SamplerState); }
public override void MoveTouch(SceneControl.TouchEvent args) { if (cancelled) return; Ray r = Camera.main.ScreenPointToRay (args.currentPosition); RaycastHit r_hit; // DID we point to anything from the touch? if (Physics.Raycast (r, out r_hit, Mathf.Infinity)) { Vector3 groundPoint = new Vector3(r_hit.point.x, lastTouchPosition.y, r_hit.point.z); if (!firstMovementComplete) { Vector3 direction = (groundPoint - lastTouchPosition); if (direction.magnitude > 7.0f) { firstDirection = (groundPoint - lastTouchPosition).normalized; firstMovementComplete = true; } } if ((groundPoint - lastTouchPosition).magnitude > 7.0f) { // Instantiate a magical light "spell" GameObject go = Instantiate( magicalLightPrefab, lastTouchPosition, Quaternion.Euler(-90.0f, 0.0f, 0.0f) ) as GameObject; Destroy(go, go.GetComponent<ParticleSystem>().duration); lastTouchPosition = groundPoint; } } }
public override void StartTouch(SceneControl.TouchEvent args) { cancelled = false; firstMovementComplete = false; // Now, what have we targeted from this click (if anything) Ray r = Camera.main.ScreenPointToRay (args.currentPosition); RaycastHit r_hit; // DID we point to anything from the touch? if (Physics.Raycast (r, out r_hit, Mathf.Infinity)) { // Only concerned with terrains for the touch down if (r_hit.collider is TerrainCollider || r_hit.collider.name == "Playable Area") { firstTouchPosition = r_hit.point; lastTouchPosition = r_hit.point; } else { //Debug.Log ("Cancelling click"); cancelled = true; } } }
public override void EndTouch(SceneControl.TouchEvent args) { // Now, what have we targeted from this click (if anything) Ray r = Camera.main.ScreenPointToRay (args.currentPosition); RaycastHit r_hit; // DID we point to anything from the touch? if (Physics.Raycast (r, out r_hit, Mathf.Infinity)) { GameObject go = Instantiate( lightningPrefab, r_hit.point, Quaternion.Euler(-90.0f, 0.0f, 0.0f) ) as GameObject; Collider[] objs = Physics.OverlapSphere( r_hit.point, lightningRange ); foreach( Collider obj in objs) { commonAI gameObj = obj.GetComponent<commonAI>(); if (gameObj != null) { ICanBeStruckDown strike = gameObj as ICanBeStruckDown; if (strike != null) { //Debug.Log ("Found object: " + obj.name); strike.StrikeDown(); } } Rigidbody rb = obj.GetComponent<Rigidbody>(); if (rb != null) { rb.AddForce(5.0f*(rb.transform.position-r_hit.point).normalized, ForceMode.Impulse); } } Destroy(go, go.GetComponent<ParticleSystem>().duration); } }
//public static Quaternion identity; //public GameObject btnPrefab= Instantiate(Resources.Load("MyPrefab")) as GameObject; //public RectTransform panel = canvas.GetComponentInChildren<RectTransform>(); // Use this for initialization void Awake () { if (control == null) { DontDestroyOnLoad (gameObject); control = this; } else if(control != this){ Destroy(gameObject); } }
public override void DepthExtractor(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Microsoft.Xna.Framework.Matrix View, Microsoft.Xna.Framework.Matrix projection, SceneControl.RenderHelper render) { SimpleTree tree = (obj.Modelo as TreeModel).Tree; tree.DrawTrunk(obj.WorldMatrix, View, projection, false, true); render.ResyncStates(); tree.DrawLeaves(obj.WorldMatrix, View, projection, false, true); render.ResyncStates(); }
private void FormScene_Load(object sender, EventArgs e) { m_sceneControl = new SceneControl(); m_sceneControl.Dock = DockStyle.Fill; m_sceneControl.IsAlwaysUpdate = true; this.Controls.Add(m_sceneControl); }
/// <summary> /// 单例模式添加单例实体 /// </summary> /// <returns></returns> public static SmObjectLocator getInstance() { if (smObjectLocator == null) { smObjectLocator = new SmObjectLocator(); globeObject = new SceneControl(); } return smObjectLocator; }
// Use this for initialization void Start() { if (sceneControl == null) { if ((sceneControl = this.gameObject.GetComponent<SceneControl>()) == null) { Debug.LogError("Unable to find the SceneControl to use with the KeyMouseInput"); } } }
/// <summary> /// 单例模式添加单例实体 /// </summary> /// <returns></returns> public static SmObjectLocator getInstance() { //初始化三维基本对象 if (smObjectLocator == null) { smObjectLocator = new SmObjectLocator(); globeObject = new SceneControl(); flyManagerObject = globeObject.Scene.FlyManager; } return smObjectLocator; }
void Start() { // SceneControl must exist in the scene with a SceneControl-based component attached // TODO -- move this to a UI superclass (UI_Base) GameObject obj = GameObject.Find("SceneControl"); if (obj) { sceneControl = obj.GetComponent<SceneControl>(); if (sceneControl) return; // successfully located SceneControl reference } Debug.LogError("SceneControl not found! Make sure scene contains a game object named SceneControl with a script attached."); }
protected override void PosWithDepthDraw(SceneControl.RenderHelper render, Microsoft.Xna.Framework.GameTime gt, ref Microsoft.Xna.Framework.Matrix activeView, ref Microsoft.Xna.Framework.Matrix activeProjection) { base.PosWithDepthDraw(render, gt, ref activeView, ref activeProjection); foreach (var item in debugDrawers) { foreach (var shape in item.GetShapes()) { shape.Draw(render, activeView, activeProjection); } item.EndFrame(); } }
protected override void AfterDraw(SceneControl.RenderHelper render, GameTime gt, ref Matrix activeView, ref Matrix activeProjection) { base.AfterDraw(render, gt, ref activeView, ref activeProjection); _TotalTime += (float)gt.ElapsedGameTime.TotalSeconds; _Fps += 1; if (_TotalTime >= 1.0f) { _TotalTime = _TotalTime - (float)(_TotalTime); _DisplayFPS = _Fps; _Fps = 0; } }
/// <summary> /// Processes the draw. /// </summary> /// <param name="uselayer">if set to <c>true</c> [uselayer].</param> /// <param name="gameTime">The game time.</param> /// <param name="render">The render.</param> /// <param name="camera">The camera.</param> /// <param name="objects">The objects.</param> public void ProcessDraw(bool uselayer, GameTime gameTime, SceneControl.RenderHelper render, SceneControl._2DScene.ICamera2D camera, List<SceneControl._2DScene.I2DObject> objects) { if(uselayer) render.RenderBegin(camera.View, null,SpriteSortMode.BackToFront); else render.RenderBegin(camera.View, null, SpriteSortMode.Deferred); foreach (var iobj in objects) { if (iobj.PhysicObject.Enabled == true) { iobj.Material.Draw(gameTime, iobj, render); } } render.RenderEnd(); }
void Start() { if (sceneControl == null && enablePinchToZoom) { if ((sceneControl = this.gameObject.GetComponent<SceneControl>()) == null) { Debug.LogError("Unable to find the SceneControl to use with the TouchInput"); enablePinchToZoom = false; } } if (keyMouseInput == null) { if ((keyMouseInput = this.gameObject.GetComponent<KeyMouseInput>()) == null) { Debug.LogError("Unable to find the KeyMouseInput to use with the TouchInput"); } } if (!Input.multiTouchEnabled) { enablePinchToZoom = false; enableMultiTouchSwipe = false; } }
public override void Draw(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, RenderHelper render, Cameras.ICamera cam) { effect.Texture = obj.Modelo.getTexture(Modelo.TextureType.DIFFUSE); effect.View = cam.View; effect.Projection = cam.Projection; for (int i = 0; i < obj.Modelo.MeshNumber; i++) { BatchInformation[] bi = obj.Modelo.GetBatchInformation(i); for (int j = 0; j < bi.Count(); j++) { effect.World = bi[j].ModelLocalTransformation; effect.CurrentTechnique.Passes[0].Apply(); render.RenderBatch(ref bi[j]); } } }
public RodeExectionAnalysis(SceneControl sceneControl, UseData UseData) { mSceneControl = sceneControl; mUseData = UseData; Initialize(); }
public void SetValue(Workspace workspace, SceneControl sceneControl) { m_workspace = workspace; m_sceneControl = sceneControl; }
private void LevelSelect() { Debug.Log("Start Game"); Persistent.SetPlayerSlots(playerPens.Take(nextSlotNumber).Select(s => s.GetInfo()).ToList()); SceneControl.ToLevelSelect(); }
/// <summary> /// Normal Drawn Function. /// </summary> /// <param name="gt">The gt.</param> /// <param name="obj">The obj.</param> /// <param name="cam">The cam.</param> /// <param name="lights">The lights.</param> /// <param name="render">The render.</param> public void Drawn(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList<Light.ILight> lights, SceneControl.RenderHelper render) { WorldMatrix.SetValue(obj.PhysicObject.WorldMatrix); ViewMatrix.SetValue(cam.View); ProjectionMatrix.SetValue(cam.Projection); TerrainShader.CurrentTechnique = TerrainShader.Techniques["Technique1"]; TerrainShader.CurrentTechnique.Passes[0].Apply(); QuadTerrain.DrawTerrain(TerrainShader, render.device); render.ResyncStates(); }
public float GetAsRatio() { return(GameController.OnGodot ? (float)SceneControl.Call("get_as_ratio") : default);
public void OnClickPlay() { SceneControl.LoadLevel(currentLevel.info.LevelIndex); }
/// <summary> /// Invalidates this scene node. /// </summary> public void Invalidate() { SceneControl.Invalidate(); }
public int GetItemAtPosition(Vector2 position, bool exact = false) { return(GameController.OnGodot ? (int)SceneControl.Call("get_item_at_position", position.Convert(), exact) : default);
private void Start() { scene = FindObjectOfType <SceneControl>(); lista = FindObjectOfType <ListaDialogos>(); }
protected override void OnTick() { // Get all players var players = Entities.WithAllReadOnly <PlayerComponent, GridPos>() .ToEntityQuery() .ToEntityArray(Allocator.TempJob); // Get all end game flags var flags = Entities.WithAllReadOnly <EndGameFlagComponent, GridPos>() .ToEntityQuery() .ToEntityArray(Allocator.TempJob); // check if each player reached flag bool playerWin = false; foreach (var player in players) { // get current player pos var playerPos = EntityManager.GetComponentData <GridPos>(player); foreach (var flag in flags) { // get current flag pos var flagPos = EntityManager.GetComponentData <GridPos>(flag); // player reached flag? if (playerPos == flagPos) { playerWin = true; break; } } // Get out if player reached flag if (playerWin) { break; } } players.Dispose(); flags.Dispose(); if (playerWin) { SceneControl.DestroyCurrentScene(); SceneManager.LoadScene("MainMenu"); } /*Entities.ForEach((ref PlayerComponent player, ref GridPos playerPos) => * { * Entities.ForEach((ref EndGameFlagComponent flag, ref GridPos flagPos) => * { * if (flagPos == playerPos) * { * Debug.Log("You win!"); * } * }); * });*/ }
public void MainMenu() { SceneControl.ResetCounters(); SceneManager.LoadScene("TitleScreen"); }
private void Initialize() { sceneControl = new SceneControl(); sceneControl.SetSceneState(new StartScene(sceneControl), ""); DontDestroyOnLoad(gameObject); }
// ================================================================ // // MonoBehaviour からの継承. void Awake() { this.scene_control = SceneControl.get(); this.random_bool_prev = Random.Range(0, 2) == 0 ? true : false; }
public GameScreen(ScreenComponent manager) : base(manager) { DefaultMouseMode = MouseMode.Captured; Manager = manager; Padding = Border.All(0); scene = new SceneControl(manager); scene.HorizontalAlignment = HorizontalAlignment.Stretch; scene.VerticalAlignment = VerticalAlignment.Stretch; Controls.Add(scene); debug = new DebugControl(manager); debug.HorizontalAlignment = HorizontalAlignment.Stretch; debug.VerticalAlignment = VerticalAlignment.Stretch; debug.Visible = false; Controls.Add(debug); compass = new CompassControl(manager); compass.HorizontalAlignment = HorizontalAlignment.Center; compass.VerticalAlignment = VerticalAlignment.Top; compass.Margin = Border.All(10); compass.Width = 300; compass.Height = 50; Controls.Add(compass); toolbar = new ToolbarControl(manager); toolbar.HorizontalAlignment = HorizontalAlignment.Stretch; toolbar.VerticalAlignment = VerticalAlignment.Bottom; toolbar.Height = 100; Controls.Add(toolbar); minimap = new MinimapControl(manager, scene); minimap.HorizontalAlignment = HorizontalAlignment.Right; minimap.VerticalAlignment = VerticalAlignment.Bottom; minimap.Width = 128; minimap.Height = 128; minimap.Margin = Border.All(5); Controls.Add(minimap); healthbar = new HealthBarControl(manager); healthbar.HorizontalAlignment = HorizontalAlignment.Left; healthbar.VerticalAlignment = VerticalAlignment.Bottom; healthbar.Width = 240; healthbar.Height = 78; healthbar.Maximum = 100; healthbar.Value = 40; healthbar.Margin = Border.All(20, 30); Controls.Add(healthbar); crosshair = new CrosshairControl(manager); crosshair.HorizontalAlignment = HorizontalAlignment.Center; crosshair.VerticalAlignment = VerticalAlignment.Center; crosshair.Width = 8; crosshair.Height = 8; Controls.Add(crosshair); Title = Languages.OctoClient.Game; RegisterKeyActions(); }
void init() { scon = new SceneControl(); scon.Dock = DockStyle.Fill; this.Controls.Add(scon); string wsPath = @"D:\模型找正面\ws.smwu"; ws = new Workspace(); WorkspaceConnectionInfo wsCon = new WorkspaceConnectionInfo() { Server = wsPath, Type = WorkspaceType.SMWU }; ws.Open(wsCon); scon.Scene.Workspace = ws; scon.Scene.Open(ws.Scenes[0]); scon.Scene.EnsureVisible(scon.Scene.Layers[0]); }
void OnGUI() { //スコア if (this.scene_control.IsDrawScore()) { this.score_control.draw(); } // 『開始』の文字. //this.scene_control.drawTitle(); // 『はじめ』の文字. if (this.scene_control.step == SceneControl.STEP.START) { TitleSceneControl.drawTexture(this.scene_control.StartTexture, start_texture_x, start_texture_y, 1.0f, 1.0f, 0.0f, 1.0f); } // オニを切った数の評価の表示. if (this.scene_control.step == SceneControl.STEP.RESULT_DEFEAT) { TitleSceneControl.drawTexture(defeat_base_texture, defeat_base_texture_x, defeat_base_texture_y, this.gui_eval_scale, this.gui_eval_scale, 0.0f, this.gui_eval_alpha); TitleSceneControl.drawTexture(GetDefeatRankTexture(), defeat_texture_x, defeat_texture_y, this.gui_eval_scale, this.gui_eval_scale, 0.0f, this.gui_eval_alpha); } // オニを切った数とオニを切ったタイミングの評価の表示. if (this.scene_control.step == SceneControl.STEP.RESULT_EVALUATION) { TitleSceneControl.drawTexture(defeat_base_texture, defeat_base_texture_x, defeat_base_texture_y, 1.0f, 1.0f, 0.0f, 1.0f); TitleSceneControl.drawTexture(GetDefeatRankTexture(), defeat_texture_x, defeat_texture_y, 1.0f, 1.0f, 0.0f, 1.0f); TitleSceneControl.drawTexture(eval_base_texture, eval_base_texture_x, eval_base_texture_y, this.gui_eval_scale, this.gui_eval_scale, 0.0f, this.gui_eval_alpha); TitleSceneControl.drawTexture(GetEvalRankTexture(), eval_texture_x, eval_texture_y, this.gui_eval_scale, this.gui_eval_scale, 0.0f, this.gui_eval_alpha); } // 最終評価の表示. if (this.scene_control.step >= SceneControl.STEP.RESULT_TOTAL) { TitleSceneControl.drawTexture(GetTotalRankTexture(), total_texture_x, total_texture_y, this.gui_eval_scale, this.gui_eval_scale, 0.0f, this.gui_eval_alpha); } // 『戻る』の文字. if (this.scene_control.step >= SceneControl.STEP.GAME_OVER) { TitleSceneControl.drawTexture(this.scene_control.ReturnButtonTexture, return_texture_x, return_texture_y); } // ---------------------------------------------------------------- // // デバッグ用 #if fasle SceneControl scene = this.scene_control; GUI.color = Color.white; GUI.matrix = Matrix4x4.identity; float x = 100; float y = 100; float dy = 16; GUI.Label(new Rect(x, y, 100, 100), scene.attack_time.ToString()); y += dy; GUI.Label(new Rect(x, y, 100, 100), scene.evaluation.ToString()); y += dy; if (this.scene_control.level_control.is_random) { GUI.Label(new Rect(x, y, 150, 100), "RANDOM(" + scene.level_control.group_type_next.ToString() + ")"); } else { GUI.Label(new Rect(x, y, 150, 100), scene.level_control.group_type_next.ToString()); } //this.scene_control.GetEvaluationTexture(); y += dy; //GUI.Label(new Rect(x, y, 100, 100), this.game_timer.ToString()); //y += 20; // SceneControl.IS_AUTO_ATTACK = GUI.Toggle(new Rect(x, y, 100, 20), SceneControl.IS_AUTO_ATTACK, "auto"); y += 50; /* * if(GUI.Toggle(new Rect(x, y, 100, 100), this.evaluation_auto_attack == EVALUATION.GREAT, "great")) { * * this.evaluation_auto_attack = EVALUATION.GREAT; * } * y += 20; * * if(GUI.Toggle(new Rect(x, y, 100, 100), this.evaluation_auto_attack == EVALUATION.GOOD, "good")) { * * this.evaluation_auto_attack = EVALUATION.GOOD; * } * y += 20;*/ scene.evaluation_auto_attack = (SceneControl.EVALUATION)GUI.Toolbar(new Rect(x, y, 200, 20), (int)scene.evaluation_auto_attack, SceneControl.evaluation_str); y += dy; // リザルト. x = 300; y = 100; GUI.Label(new Rect(x, y, 100, 100), scene.result.oni_defeat_num.ToString()); y += dy; for (int i = 0; i < (int)SceneControl.EVALUATION.NUM; i++) { GUI.Label(new Rect(x, y, 100, 100), ((SceneControl.EVALUATION)i).ToString() + " " + scene.result.eval_count[i].ToString()); y += dy; } GUI.Label(new Rect(x, y, 100, 100), "rank " + scene.result.rank.ToString()); y += dy; if (0 <= (int)scene.evaluation_auto_attack && (int)scene.evaluation_auto_attack <= 2) { scene.result.rank = (int)scene.evaluation_auto_attack; } #endif }
public void Initialization(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory, SceneControl.IObject obj) { //Add the normal texture to the shader TerrainShader.Parameters["NormalTexture"].SetValue(QuadTerrain.globalNormalTexture); //Set the Global Scale (used for the normal and blending textures) value in the shader. TerrainShader.Parameters["globalScale"].SetValue(QuadTerrain.flatScale * QuadTerrain.TerrainHeight); }
public MaterialStatist(SceneControl m_SceneControl) { mSceneControl = m_SceneControl; InitializeComponent(); }
public void AfterAdded(SceneControl.IObject obj) { }
public OwnerStatist(SceneControl m_SceneControl) { mSceneControl = m_SceneControl; InitializeComponent(); }
public void Initialize(Workspace workspace, SceneControl sceneControl) { m_workspace = workspace; m_sceneControl = sceneControl; }
public void OnMainMenuButton() { SceneControl.LoadMenu(); }
private void Awake() { instance = this; }
//------------------------------------------------------------------------// // Use this for initialization void Start() { this.scene_control = GetComponent <SceneControl>(); this.score_control = GetComponent <ScoreControl>(); }
public ChooseChapterScene(SceneControl sceneControl) : base(sceneControl) { }
void Start() { instance = this; instance.StartCoroutine(instance.Setup()); }
private void OnExitGamePressed() { SceneControl.DestroyCurrentScene(); SceneManager.LoadScene("MainMenu"); }
void Awake() { Instance = this; }
// Update is called once per frame void Update() { Animator animator = this.GetComponentInChildren <Animator>(); // ---------------------------------------------------------------- // // 着地するときに地面にめり込んでしまうので. // (かっこ悪いけど). if (this.transform.position.y < 0.0f) { this.is_grounded = true; Vector3 pos = this.transform.position; pos.y = 0.0f; this.transform.position = pos; } // ---------------------------------------------------------------- // // ステップ内の経過時間を進める. this.step_timer += Time.deltaTime; // ---------------------------------------------------------------- // // 次の状態に移るかどうかを、チェックする. // 前のフレームのコリジョン結果を調べる. if (this.step != STEP.MISS) { this.coli_result.resolveCollision(); } // if (this.next_step == STEP.NONE) { switch (this.step) { case STEP.NONE: { this.next_step = STEP.STAND; } break; case STEP.STAND: { // シフトキーで走り始める. if (Input.GetKeyDown(KeyCode.LeftShift)) { this.next_step = STEP.RUN; } // スペースキーでジャンプ. if (Input.GetKeyDown(KeyCode.Space)) { this.next_step = STEP.JUMP; } } break; case STEP.RUN: { if (!this.is_auto_drive) { if (Input.GetKeyDown(KeyCode.Space)) { this.next_step = STEP.JUMP; } } } break; case STEP.JUMP: { // 着地したら立ち、または走りへ. if (this.is_grounded) { GetComponent <AudioSource>().clip = LANDING_SOUND; GetComponent <AudioSource>().Play(); this.next_step = this.action_jump.prevoius_step; } } break; case STEP.MISS: { if (this.step_timer > 3.0f) { //GameObject.FindWithTag("MainCamera").transform.SendMessage("applyDamage", 1); SceneControl.get().onPlayerMissed(); if (this.scene_control.getLifeCount() > 0) { this.transform.position = this.room_control.getRestartPosition(); this.room_control.onRestart(); // アニメーションは補間しない. this.action_stand.is_fade_anim = false; this.next_step = STEP.STAND; } else { this.next_step = STEP.GAMEOVER; } } } break; } } // ---------------------------------------------------------------- // // 状態が遷移したときの初期化. if (this.next_step != STEP.NONE) { switch (this.next_step) { case STEP.STAND: { Vector3 v = this.GetComponent <Rigidbody>().velocity; v.x = 0.0f; v.z = 0.0f; this.GetComponent <Rigidbody>().velocity = v; // 立ちアニメーションの再生. if (this.action_stand.is_fade_anim) { animator.SetTrigger("standing"); } else { animator.SetTrigger("standing_no_fade"); } this.action_stand.is_fade_anim = true; } break; case STEP.RUN: { animator.SetTrigger("running"); } break; case STEP.JUMP: { Vector3 v = this.GetComponent <Rigidbody>().velocity; v.y = Mathf.Sqrt(2.0f * 9.8f * JUMP_HEIGHT_MAX); this.GetComponent <Rigidbody>().velocity = v; // this.action_jump.is_key_released = false; this.action_jump.prevoius_step = this.step; this.action_jump.launch_velocity_xz = this.GetComponent <Rigidbody>().velocity; this.action_jump.launch_velocity_xz.y = 0.0f; // animator.SetTrigger("jump"); GetComponent <AudioSource>().clip = JUMP_SOUND; GetComponent <AudioSource>().Play(); } break; case STEP.MISS: { // 後ろに跳ね返る. Vector3 v = this.GetComponent <Rigidbody>().velocity; v.z *= -0.5f; this.GetComponent <Rigidbody>().velocity = v; // エフェクト this.effect_control.createMissEffect(this); // 鉄板に当たった音 or ふすまに当たった音. // if (this.action_miss.is_steel) { GetComponent <AudioSource>().PlayOneShot(FAILED_STEEL_SOUND); } else { GetComponent <AudioSource>().PlayOneShot(FAILED_FUSUMA_SOUND); } // やられ声. // GetComponent <AudioSource>().PlayOneShot(FAILED_NEKO_SOUND); animator.SetTrigger("failed_1"); this.coli_result.lock_target.enable = false; this.is_fallover = false; SceneControl.get().onPlayerHitted(); } break; case STEP.FREE_MOVE: { this.GetComponent <Rigidbody>().useGravity = false; this.GetComponent <Rigidbody>().velocity = Vector3.zero; } break; } this.step = this.next_step; this.next_step = STEP.NONE; this.step_timer = 0.0f; } // ---------------------------------------------------------------- // // 各状態での実行処理. // 左右移動、ジャンプによるローテーション. this.rotation_control(); switch (this.step) { case STEP.STAND: { } break; case STEP.RUN: { // 前への加速. Vector3 v = this.GetComponent <Rigidbody>().velocity; v.z += (RUN_ACCELE)*Time.deltaTime; v.z = Mathf.Clamp(v.z, 0.0f, RUN_SPEED_MAX); // 左右への平行移動. if (this.is_auto_drive) { v = this.side_move_auto_drive(v, 1.0f); } else { v = this.side_move(v, 1.0f); } // this.GetComponent <Rigidbody>().velocity = v; } break; case STEP.JUMP: { Vector3 v = this.GetComponent <Rigidbody>().velocity; // ジャンプ中にキーを離したら、上昇速度を減らす. // (キーを押す長さでジャンプの高さを制御できるように). do { if (!Input.GetKeyUp(KeyCode.Space)) { break; } // 一度離した後はやらない(連打対策). if (this.action_jump.is_key_released) { break; } // 下降中はやらない. if (this.GetComponent <Rigidbody>().velocity.y <= 0.0f) { break; } // v.y *= JUMP_KEY_RELEASE_REDUCE; this.GetComponent <Rigidbody>().velocity = v; this.action_jump.is_key_released = true; } while(false); // 左右への平行移動. // (ジャンプ中も多少は制御できるようにしたい). // if (this.is_auto_drive) { this.GetComponent <Rigidbody>().velocity = this.side_move_auto_drive(this.GetComponent <Rigidbody>().velocity, SLIDE_ACCEL_SCALE_JUMP); } else { this.GetComponent <Rigidbody>().velocity = this.side_move(this.GetComponent <Rigidbody>().velocity, SLIDE_ACCEL_SCALE_JUMP); } // // 組子に当たったときは、穴の中心の方へ誘導する. if (this.coli_result.shoji_hit_info.is_enable) { // v = this.GetComponent <Rigidbody>().velocity; if (this.coli_result.lock_target.enable) { v = this.coli_result.lock_target.position - this.transform.position; } v.z = this.action_jump.launch_velocity_xz.z; this.GetComponent <Rigidbody>().velocity = v; } } break; case STEP.MISS: { // 徐々に減速する. Vector3 v = this.GetComponent <Rigidbody>().velocity; v.y = 0.0f; float speed_xz = v.magnitude; if (this.is_grounded) { speed_xz -= RUN_SPEED_DECELE_MISS * Time.deltaTime; } else { speed_xz -= RUN_SPEED_DECELE_MISS_JUMP * Time.deltaTime; } speed_xz = Mathf.Max(0.0f, speed_xz); v.Normalize(); v *= speed_xz; v.y = this.GetComponent <Rigidbody>().velocity.y; this.GetComponent <Rigidbody>().velocity = v; // 着地したら、やられモーションその2へ. do { AnimatorStateInfo state_info = animator.GetCurrentAnimatorStateInfo(0); if (this.is_fallover) { break; } if (!this.is_grounded) { break; } // 最初のモーション(failed_1)が1ループ再生されるまで待つ. if (!state_info.IsName("failed_1")) { break; } if (state_info.normalizedTime < 1.0f) { break; } animator.SetTrigger("failed_2"); GetComponent <AudioSource>().clip = FALL_OVER_SOUND; GetComponent <AudioSource>().Play(); this.is_fallover = true; } while(false); } break; case STEP.FREE_MOVE: { float speed = 400.0f; Vector3 v = Vector3.zero; if (Input.GetKey(KeyCode.RightArrow)) { v.x = +speed * Time.deltaTime; } if (Input.GetKey(KeyCode.LeftArrow)) { v.x = -speed * Time.deltaTime; } if (Input.GetKey(KeyCode.UpArrow)) { v.y = +speed * Time.deltaTime; } if (Input.GetKey(KeyCode.DownArrow)) { v.y = -speed * Time.deltaTime; } if (Input.GetKey(KeyCode.LeftShift)) { v.z = +speed * Time.deltaTime; } if (Input.GetKey(KeyCode.RightShift)) { v.z = -speed * Time.deltaTime; } this.GetComponent <Rigidbody>().velocity = v; } break; } // ---------------------------------------------------------------- // this.is_grounded = false; this.coli_result.shoji_hit_info.is_enable = false; this.coli_result.hole_hit_infos.Clear(); this.coli_result.obstacle_hit_info.is_enable = false; this.previous_velocity = this.GetComponent <Rigidbody>().velocity; }
// Start is called before the first frame update void Start() { scene = GetComponent <SceneControl>(); box = GetComponent <ObjectReference>(); StartCoroutine(LoadSceneInBG()); }
public void SetSceneControl(SceneControl sceneControl) { m_sceneControl = sceneControl; }
/// <summary> /// Draws the specified gt. /// </summary> /// <param name="gt">The gt.</param> /// <param name="obj">The obj.</param> /// <param name="render">The render.</param> /// <param name="cam">The cam.</param> /// <param name="lights">The lights.</param> protected override void Draw(GameTime gt, SceneControl.IObject obj, SceneControl.RenderHelper render, Cameras.ICamera cam, System.Collections.Generic.IList<Light.ILight> lights) { }
// -------------------------------------------------------------------------------- // void Start() { this.scene_control = GetComponent<SceneControl>(); this.score_control = GetComponent<ScoreControl>(); this.score_control.setNumForce( this.scene_control.result.oni_defeat_num ); }
/// <summary> /// Draw the object in a simple way (WITH MINIMUM EFFECTS,....) /// USED IN RELECTIONS, REFRACTION ..... /// </summary> /// <param name="gt">The gt.</param> /// <param name="obj">The obj.</param> /// <param name="view">The view.</param> /// <param name="projection">The projection.</param> /// <param name="lights">The lights.</param> /// <param name="render">The render.</param> /// <param name="clippingPlane">The clipping plane.</param> /// <param name="useAlphaBlending">if set to <c>true</c> [use alpha blending].</param> public override void BasicDraw(GameTime gt, SceneControl.IObject obj, ref Matrix view, ref Matrix projection, System.Collections.Generic.IList<Light.ILight> lights, SceneControl.RenderHelper render, Plane? clippingPlane, bool useAlphaBlending = false) { }
//public CursorMode cursorMode = CursorMode.Auto; void Start() { UnityEngine.Cursor.visible = true; sceneControl = GameObject.FindObjectOfType <SceneControl>(); //Cursor.SetCursor(cursorTexture); }
/// <summary> /// Exctract the depth from an object /// </summary> /// <param name="gt">The gt.</param> /// <param name="obj">The obj.</param> /// <param name="View">The view.</param> /// <param name="projection">The projection.</param> /// <param name="render">The render.</param> public override void DepthExtractor(GameTime gt, SceneControl.IObject obj, ref Matrix View, ref Matrix projection, SceneControl.RenderHelper render) { }
/// <summary> /// Pos drawn Function. /// Called after all objects are Draw /// </summary> /// <param name="gt">The gt.</param> /// <param name="obj">The obj.</param> /// <param name="cam">The cam.</param> /// <param name="lights">The lights.</param> /// <param name="render">The render.</param> public void PosDrawnPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList<Light.ILight> lights, SceneControl.RenderHelper render) { }
/// <summary> /// Initializes this instance. /// </summary> /// <param name="ginfo"></param> /// <param name="factory"></param> /// <param name="obj"></param> public override void Initialize(GraphicInfo ginfo, GraphicFactory factory, SceneControl.IObject obj) { }
public void Update(Microsoft.Xna.Framework.GameTime gametime, SceneControl.IObject obj, IWorld world) { ICamera cam = world.CameraManager.ActiveCamera; QuadTerrain.UpdateTerrain(cam.Position, cam.BoundingFrustum, LOD); }
public static void Init() { eventManager = new Crowd.EventManager(); if (taskManager == null) { taskManager = new Crowd.TaskManager(); } if (GameObject.Find("PathFinder")) { pathFindingManager = GameObject.Find("PathFinder").GetComponent<PathFindingManager>(); } else { pathFindingManager = null; } if (GameObject.Find("LevelEvents")) { levelEventsController = GameObject.Find("LevelEvents").GetComponent<LevelEventsControl>(); } else { levelEventsController = null; } if (GameObject.FindGameObjectWithTag("GameController")) { mainController = GameObject.FindGameObjectWithTag("GameController").GetComponent<MainControl>(); inputController = mainController.gameObject.GetComponent<InputControl>(); sceneController = mainController.gameObject.GetComponent<SceneControl>(); gameEvents = mainController.gameObject.GetComponent<GameEvents>(); dotweenEvents = mainController.gameObject.GetComponent<DotweenEvents>(); if (inputController != null && inputController.groundEnabled) { tileMarkerManager = new TileMarkerManager(); tileMarkerManager.Init(); } else { tileMarkerManager = null; } } else { mainController = null; inputController = null; sceneController = null; gameEvents = null; dotweenEvents = null; } if (GameObject.FindGameObjectWithTag("Transition")) { sceneTransitionController = GameObject.FindGameObjectWithTag("Transition").GetComponent<SceneTransitionControl>(); } else { sceneTransitionController = null; } //if (GameObject.FindGameObjectWithTag("Comic")) //{ // comicEvents = GameObject.FindGameObjectWithTag("Comic").GetComponent<ComicEvents>(); //} //else { comicEvents = null; } if (soundController == null) { soundController = new SoundControl(); soundController.Init(); } if (fmodController == null) { fmodController = new FmodControl(); fmodController.Init(); } if (GameObject.Find("CameraSystem")) { cameraController = GameObject.Find("CameraSystem").GetComponent<CameraControl>(); } else { cameraController = null; } //if (GameObject.FindGameObjectWithTag("SoundSystem")) //{ // soundController = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent<SoundControl>(); // fmodController = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent<FmodControl>(); //} //else //{ // soundController = null; // fmodController = null; //} if (GameObject.Find("Canvas")) { hudController = GameObject.Find("Canvas").GetComponent<HUDControl>(); } else { hudController = null; } utils = new Utils(); men = new List<GameObject>(GameObject.FindGameObjectsWithTag("Man")); menParentObj = GameObject.Find("Actors"); navMeshMinBound = new Vector3(float.MaxValue, float.MaxValue); navMeshMaxBound = new Vector3(-float.MaxValue, -float.MaxValue); GameObject[] navs = GameObject.FindGameObjectsWithTag("Ground"); foreach (GameObject nav in navs) { Collider collider = nav.GetComponent<BoxCollider>(); if (collider != null) { Vector3 c_min = collider.bounds.min; Vector3 c_max = collider.bounds.max; navMeshMinBound = new Vector2( Mathf.Min(c_min.x, navMeshMinBound.x), Mathf.Min(c_min.y, navMeshMinBound.y) ); navMeshMaxBound = new Vector2( Mathf.Max(c_max.x, navMeshMaxBound.x), Mathf.Max(c_max.y, navMeshMaxBound.y) ); } } }
public SceneState(SceneControl control) { sceneControl = control; }
public void OnContinueButton() { SceneControl.LoadNextLevel(); }