private void activateTrap() { foreach (GameObject floor in MovingFloors) { MovingFloor mf = floor.GetComponent <MovingFloor>(); mf.MoveUp(); } TrapTrigger.SetActive(true); trapActivated = true; }
public void DeactivateTrap() { if (!trapActivated) { return; } foreach (GameObject floor in MovingFloors) { MovingFloor mf = floor.GetComponent <MovingFloor>(); mf.MoveDown(); } TrapTrigger.SetActive(false); }
public override void OnInspectorGUI() { DrawDefaultInspector(); MovingFloor myScript = (MovingFloor)target; EditorGUILayout.LabelField("Modification des points", EditorStyles.boldLabel); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginVertical("box"); GUILayout.Label("Ajouter"); NewCoordinates = EditorGUILayout.Vector3Field("Number of new objects", NewCoordinates); if (GUILayout.Button("Add point")) { myScript.AddDestinationPoint(NewCoordinates); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); GUILayout.Label("Supprimer"); index = EditorGUILayout.IntField("Index", index); index = Mathf.Clamp(index, 0, myScript.PointCount); if (GUILayout.Button("Destroy at index")) { myScript.DestroyPoint(index); } if (GUILayout.Button("Destroy last point")) { myScript.DestroyLastPoint(); } if (GUILayout.Button("Destroy all")) { myScript.DestroyAll(); } EditorGUILayout.EndVertical(); if (GUILayout.Button("Refresh list")) { myScript.ReloadPointToList(); } EditorGUILayout.EndVertical(); }
private MainCharactor() : base(SaveObject.RestartPoint, new Size(10, 20)) { MainCharactorStatus = MainCharactorStatus.Idle; Direction = Direction.Right; HitYEvent += obj => { if (obj.IsSolid) { _vy = 0; if (obj.Top.Y >= Bottom.Y) { if (Vx != 0) MainCharactorStatus = MainCharactorStatus.Run; else { MainCharactorStatus = MainCharactorStatus.Idle; } if (obj is MovingFloor) { movingFloor = (MovingFloor)obj; } if (Input.Instance.LeftShift) { _vy = -3; jumpflame = 1; } } } }; HitXEvent += obj => { if (obj.IsSolid) { _vx = 0; } }; HitEvent += obj => { obj.OnBeHitEvent(); if (obj is SaveObject) { ((SaveObject)obj).Save(); } if (obj is IKiller) { ((IKiller)obj).Kill(this); // DX.DrawString(400, 200, "Game Over", DX.GetColor(200, 200, 200)); } }; }
public override void Update(MapBase map) { // 銃 if (Input.Instance.Z) { if (_bulletIntervalCount <= 0) { Bullet bullet; if (Direction == Direction.Right) { bullet = new Bullet(new Point(Point.X + 11, Point.Y + 7), Direction); } else { bullet = new Bullet(new Point(Point.X - 11, Point.Y + 7), Direction); } map.AddElement(bullet); map.UpdateElement(); _bulletIntervalCount = BULLETINTERVAL; } } if (_bulletIntervalCount > 0) { _bulletIntervalCount--; } // ジャンプ if (Input.Instance.LeftShift) { if (jumpflame != 0) { if (jumpflame < 20) { if (jumpflame == 1) { SoundManager.Play("jump", DX.DX_PLAYTYPE_BACK); } jumpflame++; _vy = -8; } else { jumpflame = 0; } } } else { jumpflame = 0; } // 移動 ay = 5; ax = 0; if (Input.Instance.Right) { Direction = Direction.Right; ax += 5; } if (Input.Instance.Left) { Direction = Direction.Left; ax -= 5; } if (!Input.Instance.Right && !Input.Instance.Left) { _vx = 0; } if (movingFloor != null) { Top = new Point(Top.X + movingFloor.Distance.X * 2, Top.Y + movingFloor.Distance.Y * 2); movingFloor = null; } // 状態 if (Top.Y > 600) { Death(); } if (Vy < 0) { MainCharactorStatus = MainCharactorStatus.Jump; } else if (Vy > 5) { MainCharactorStatus = MainCharactorStatus.Fall; } // 更新 base.Update(map); Distance = new Point(Vx, Vy); }