// Use this for initialization void Start() { //text = GameObject.Find("Text").GetComponent<Text>(); wallObject = GameObject.Find("fence"); currentHealth = 200; instance = this; }
private void SetAdjacentWall(WallController wall, Side side) { WallPoint wp = wall.Position; WallPoint adjWallPoint = null; switch (side) { case Side.Bottom: adjWallPoint = new WallPoint(wp.X, wp.Y - 1); break; case Side.Left: adjWallPoint = new WallPoint(wp.X - 1, wp.Y); break; case Side.Right: adjWallPoint = new WallPoint(wp.X + 1, wp.Y); break; case Side.Top: adjWallPoint = new WallPoint(wp.X, wp.Y + 1); break; } WallController adjWall = GetWall(adjWallPoint); if (adjWall == null) { if (WallPrefab.PrefabValidatePosition(M, adjWallPoint)) { wall.wallSprite.SetSide(side, true); SetWall(adjWallPoint, WallPrefab); } } else if (adjWall.WallObject == null) { wall.wallSprite.SetSide(side, true); } }
public PlayerController(PlayerCharacter player, PlayerData playerData, PlayerControls controls, ControlSettings settings, AbstractController[] controllers) { this.player = player; this.playerData = playerData; this.controls = controls; this.settings = settings; aerialController = (AerialController)controllers[PlayerCharacter.ControllerIndexes.Air]; groundController = (GroundController)controllers[PlayerCharacter.ControllerIndexes.Ground]; platformController = (PlatformController)controllers[PlayerCharacter.ControllerIndexes.Platform]; wallController = (WallController)controllers[PlayerCharacter.ControllerIndexes.Wall]; ladderController = (LadderController)controllers[PlayerCharacter.ControllerIndexes.Ladder]; // TODO: Make this class reloadable. // Create buffers. var accessor = Properties.Access(); var grab = accessor.GetFloat("player.grab.buffer"); var ascend = accessor.GetFloat("player.ascend.buffer"); // Actual values for requiresHold on each buffer are set when control settings are applied. attackBuffer = new InputBuffer(false, controls.Attack); grabBuffer = new InputBuffer(grab, false, controls.Grab); ascendBuffer = new InputBuffer(ascend, false, controls.Jump); ascendBuffer.RequiredChords = controls.Ascend; settings.ApplyEvent += OnApply; MessageSystem.Subscribe(this, CoreMessageTypes.Input, (messageType, data, dt) => { ProcessInput((FullInputData)data, dt); }); }
// Use this for initialization void Start() { //視線がぶつかる判定用壁レイヤーマスク指定 layerMask = LayerMask.GetMask(new string[] { "EyeWall" }); //壁管理クラス wallController = GameObject.Find("Walls").GetComponent <WallController>(); }
void Awake() { if (Instance == null) { Instance = this; } }
private bool PrefabGetNeighbours(Manager m, WallPoint point, out WallController w1, out WallController w2) { w1=null;w2=null; WallController left = m.House.GetWall(new WallPoint(point.X-1,point.Y)); WallController right = m.House.GetWall(new WallPoint(point.X+1,point.Y)); WallController top = m.House.GetWall(new WallPoint(point.X,point.Y+1)); WallController bottom = m.House.GetWall(new WallPoint(point.X,point.Y-1)); WallController cur = m.House.GetWall(point); if(cur!=null && cur.WallObject!=null) return false; if(left!=null && right!=null) { if(top!=null || bottom!=null) return false; w1 = left;w2=right; } else if(top!=null && bottom!=null) { if(left!=null || right!=null) return false; w1 = bottom;w2 = top; } else return false; return true; }
public void PlaceIndicators(Dictionary <int, CellController> cells, Dictionary <int, WallController> walls, WallController wallPrefab) { bool isDoor = wallPrefab.PrefabIsDoor(); foreach (CellController c in cells.Values) { if (c.IsMultiCell) { MapRect rect = c.GetCurCellIndexes(); rect.Foreach((MapPoint p) => { WallPoint wp = new WallPoint(p.X, p.Y); if ((isDoor || !walls.ContainsKey(wp.toInt())) && wallPrefab.PrefabValidatePosition(M, wp)) { InstantiateIndicator(wp, isDoor); } }); } else { WallPoint wp = new WallPoint(c.Position.X, c.Position.Y); if ((isDoor || !walls.ContainsKey(wp.toInt())) && wallPrefab.PrefabValidatePosition(M, wp)) { InstantiateIndicator(wp, isDoor); } } } }
/// <summary> /// /// Метод который реализует игровое поведение змеи /// /// </summary> /// <param name="culture"> Регион пользователя </param> /// <param name="resourceMenager"> Ресурсы для отображения сообщений пользователю </param> private static void GameProcess(WallController wallController, SnakeControllers snakeControllers, FoodController foodController, ResourceManager resourceMenager, CultureInfo culture) { while (!IsGameOver(wallController, snakeControllers)) { if (IsEatingSnake(snakeControllers, foodController)) { Point food = (Point)((ICreated)foodController).CreatedGameObject(); DrawGameObject(food); } else { MoveGameObject(snakeControllers); } Thread.Sleep(100); if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(true); snakeControllers.HandleKey(key.Key); } } WriteGameOver(resourceMenager, culture); }
private void Start() { fillCon = gameObject.GetComponent <WaterFillController>(); timer = gameObject.GetComponent <timerScript>(); wallCon = gameObject.GetComponent <WallController>(); raycaster = gameObject.GetComponent <globals>(); timer.StartTimer(); }
// Use this for initialization void Start() { //壁管理クラス取得 wallController = GameObject.Find("Walls").GetComponent <WallController>(); //リジッドボディ取得 rigid = GetComponent <Rigidbody>(); //壁管理クラスに自身を保存 wallController.CmdAddBombs(this.gameObject, wallType); }
// Use this for initialization void Start() { walls = Walls.GetComponent <WallController>(); Walls.SetActive(false); //leaves = Leaves.GetComponent<LeavesController>(); cont = true; //inside.SetActive(false); //leaves.delay = leavesDrops; }
protected override void OnCannotMove <T>(T hitComponent) { WallController wall = hitComponent as WallController; Animator animator = GetComponent <Animator> (); animator.SetTrigger("playerChop"); wall.OnAttack(damage); Log("wall life point remains : " + wall.lifePoint); }
public void Start() { this.rigidbody = this.GetComponent<Rigidbody2D>(); this.animator = this.GetComponent<Animator>(); this.wallController = this.GetComponent<WallController>(); var middleWallTransform = GameObject.Find("MiddleWall").GetComponent<Transform>(); this.middleWallX = middleWallTransform.position.x; }
/// <summary> /// (Re)Instantiates Rooms and Wall objects /// </summary> public void InstantiateAll() { InstantiateParent(ref roomParent, "Rooms"); InstantiateParent(ref wallParent, "Walls"); GameObject[][,] wallGroups = WallGenerator.InstantiateWalls(wallParent.transform, wallPrefab, n, radius); GameObject[,] rooms = RoomGenerator.InstantiateRooms(roomParent.transform, roomPrefab, radius); for (int i = 0; i < wallGroups.Length; i++) { float angle = WallGenerator.CalculateRotation(i, n) * Mathf.Deg2Rad; for (int roomY = 0; roomY < rooms.GetLength(1); roomY++) { int offset = -Mathf.Max(radius - roomY - 1, 0); for (int roomX = Mathf.Max(radius - roomY - 1, 0); roomX < rooms.GetLength(0); roomX++) { GameObject go = rooms[roomX, roomY]; if (go != null) { RoomController room = go.GetComponent <RoomController>(); if (i == 0) { WallController w1 = wallGroups[i][roomX + offset, roomY].GetComponent <WallController>(); WallController w2 = wallGroups[i][roomX + offset + 1, roomY].GetComponent <WallController>(); AddWalls(room, w1, w2); } else { Vector2 roomPosition = new Vector2(room.transform.position.x, room.transform.position.z); Vector2 rotatedPosition = roomPosition.RotateAround(0f, 0f, angle); if (TryGetGameObjectAtPosition(rooms, new Vector3(rotatedPosition.x, 0f, rotatedPosition.y), out GameObject targetRoom)) { RoomController target = targetRoom.GetComponent <RoomController>(); WallController w1 = target.Walls[0], w2 = target.Walls[1]; w1 = wallGroups[i][w1.X, w1.Y].GetComponent <WallController>(); w2 = wallGroups[i][w2.X, w2.Y].GetComponent <WallController>(); AddWalls(room, w1, w2); } else { Debug.Log($"Couldn't find room at position {rotatedPosition}"); } } } } } }
void AddToWallMap(Sequence.Wall wall, WallController wc) { int key = CalculateMonobeat(wall, null); if (!WallMap.ContainsKey(key)) { WallMap.Add(key, new List <WallController>()); } WallMap[key].Add(wc); }
public void EditorRemoveWall(WallPoint point) { WallController w = null; if (walls.TryGetValue(point.toInt(), out w)) { GameObject.DestroyImmediate(w.gameObject); walls.Remove(point.toInt()); } }
void Start() { powerup_meter = GameObject.FindObjectOfType <PowerupMeter>(); movement_vector_scaler = INITIAL_MAGNITUDE_SCALER; wcl = GameObject.FindObjectOfType <WallController>(); photon_view = GetComponent <PhotonView>(); breakshot = GameObject.FindObjectOfType <Breakshot>(); audio_source = GetComponent <AudioSource>(); audio_source.clip = balls_bounce; }
public EdgeHitContainer GetHits(WallController wall) { EdgeHitContainer curEdgeHits = null; if (_WallHits.TryGetValue(wall, out curEdgeHits)) { return(curEdgeHits); } return(null); }
private void DeleteWall(WallPoint wp) { WallController wall = GetWall(wp); if (wall != null) { Destroy(wall.gameObject); walls.Remove(wp.toInt()); UpdateWallsAround(wp); } }
//public void ForeachWall(System.Action<WallPoint,WallController> action) //{ //} public WallController PrefabSetWall(Manager m, WallPoint point) { IWallObject wo = GetComponentInterface <IWallObject>(); WallController w = m.House.ReplaceWall(point, this); if (wo != null) { wo.PrefabPrepareWall(m, w); } return(w); }
// OnCantMove overrides the abstract function OnCantMove in MovingObject. // It takes a generic parameter T which in the case of Player is a Wall which the player can attack and destroy. protected override void OnCantMove<T>(T component) { // Set hitWall to equal the component passed in as a parameter. WallController hitWall = component as WallController; // Call the DamageWall function of the Wall we are hitting. hitWall.DamageWall(wallDamage); // Set the attack trigger of the player's animation controller in order to play the player's attack animation. animator.SetTrigger("playerChop"); }
private void UpdateImmediate() { if (houseController == null) { houseController = GetComponentInParent <HouseController>(); } WallController w = houseController.GetWall(new WallPoint(position.X - 1, position.Y)); if (w == null) { wallSprite.Left = false; } else if (w.wallSprite.Right) { wallSprite.Left = true; } w = houseController.GetWall(new WallPoint(position.X + 1, position.Y)); if (w == null) { wallSprite.Right = false; } else if (w.wallSprite.Left) { wallSprite.Right = true; } w = houseController.GetWall(new WallPoint(position.X, position.Y - 1)); if (w == null) { wallSprite.Bottom = false; } else if (w.wallSprite.Top) { wallSprite.Bottom = true; } w = houseController.GetWall(new WallPoint(position.X, position.Y + 1)); if (w == null) { wallSprite.Top = false; } else if (w.wallSprite.Bottom) { wallSprite.Top = true; } wallSprite.UpdateWall(); if (WallObject != null) { WallObject.UpdateWall(); } }
private void PlaceWall(HouseController hc, WallPoint p, WallController prefab) { if (hc.GetWall(p) == null) { return; } hc.EditorRemoveWall(p); WallController w = hc.SetWall(p, prefab); w.EditorUpdateWall(); }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "MovingWall") { Debug.Log("Wall hit wall"); WallController wallCtrl = collision.gameObject.GetComponent <WallController>(); if (!wallCtrl.isMoving) { StopTweenMove(); } } }
void Awake() { wallController = GetComponent <WallController>(); _animator = GetComponent <Animator>(); _controller = GetComponent <CharacterController2D>(); combatController = GetComponent <TatsuCombatController>(); // listen to some events for illustration purposes _controller.onControllerCollidedEvent += onControllerCollider; _controller.onTriggerEnterEvent += onTriggerEnterEvent; _controller.onTriggerExitEvent += onTriggerExitEvent; }
public static bool IsFortSameTeam(GameObject fortObject, GameObject playerObject) { WallController wc = fortObject.GetComponent <WallController> (); if (wc == null) { Debug.LogError("Wall Controller is null"); return(false); } return(wc.team == GetTeam(playerObject)); }
public void TestInitializer() { _wallService = Substitute.For <IWallService>(); _notificationService = Substitute.For <INotificationService>(); _wallController = new WallController(ModelMapper.Create(), _wallService, _notificationService); _wallController.ControllerContext = Substitute.For <HttpControllerContext>(); _wallController.Request = new HttpRequestMessage(); _wallController.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); _wallController.Request.SetConfiguration(new HttpConfiguration()); _wallController.RequestContext.Principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "1") })); }
// Use this for initialization void Start() { CellController cell = GetComponent <CellController>(); CellController.CellRotation rotation = CellController.CellRotation.None; if (Autorotate && cell.SizeX == 1 && cell.SizeY == 1) { WallController bl = M.House.GetWall(new WallPoint(cell.Position.X, cell.Position.Y)); WallController tr = M.House.GetWall(new WallPoint(cell.Position.X + 1, cell.Position.Y + 1)); if (bl != null) { if (bl.wallSprite.Right) { rotation = CellController.CellRotation.None; } else if (bl.wallSprite.Top) { rotation = CellController.CellRotation.C90; } } if (tr != null) { if (tr.wallSprite.Left) { rotation = CellController.CellRotation.C180; } else if (tr.wallSprite.Bottom) { rotation = CellController.CellRotation.C270; } } cell.SetRotation(rotation); /*M.House.ForEachWall(cell.Position, (WallPoint wp, WallController wc, Corner corner) =>{ * switch(corner) * { * case Corner.BottomLeft: * if( * break; * case Corner.BottomRight: * break; * case Corner.TopLeft: * break; * case Corner.TopRight: * break; * } * });*/ } }
private void UpdateWallsAround(WallPoint wp) { for (int x = wp.X - 1; x <= wp.X + 1; x++) { for (int y = wp.Y - 1; y <= wp.Y + 1; y++) { WallController w = GetWall(new WallPoint(x, y)); if (w != null) { w.UpdateWall(); } } } }
public bool Grab(Transform origin) { if (!_thrown) { GlobalSoundManager.instance.PlayClip(GlobalSounds.PickUpEmpGrenade, SourcePosition.Center, 1); _selectingTarget = true; _wall = GameObject.Find("Wall").GetComponent <WallController>(); _maxThrusterID = _wall.LeftThrusters.Count - 1; _thrusterID = (int)Random.Range(0, _maxThrusterID + 0.1f); _throwingPlayer = origin.root.gameObject; GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); if (players[0] == _throwingPlayer) { _enemyPlayer = players[1]; } else { _enemyPlayer = players[0]; } transform.SetParent(origin); transform.localPosition = Vector3.zero; int ownerNum = (origin.transform.root.gameObject.name == "Player 1" ? 1 : 2); //hacks if (ownerNum == 1) { _thrusters = _wall.RightThrusters; } else { _thrusters = _wall.LeftThrusters; } _thrusters[_thrusterID].IsHighlighted = true; return(true); } else if (_attached) { // do stuff return(true); } else { return(false); } }
// Given a Sequence, instantiate all of the prefabs required to play the sequence. void BuildLevel(Sequence sequence) { targetsTotal = 0; targetsHit = 0; if (sequence.Walls.Length > 0) { scoreTarget = Quaternion.Euler(0, sequence.Walls[0].Angle, 0); Debug.Log("Rotating to first wall at " + sequence.Walls[0].Angle); } foreach (Sequence.Wall wall in sequence.Walls) { Vector2 lastLeft = Vector2.zero; Vector2 lastRight = Vector2.zero; // Instantiate and configure a wall GameObject wallObj = Instantiate(WallPrefab, GameRoot); WallController wallController = wallObj.GetComponent <WallController>(); wallController.Wall = wall; wallController.Tolerance = sequence.Tolerance; AddToWallMap(wall, wallController); wallObj.name = "Wall for " + wall.Measure + " " + wall.Passage.Name; wallObj.transform.Rotate(Vector3.up, wall.Angle); Transform drawingPlane = wallController.DrawingPlane; foreach (Passage.Step step in wall.Passage.Steps) { // Instantiate and configure targets for left and right hands Vector2 left = new Vector2(step.LX, step.LY); Vector2 right = new Vector2(step.RX, step.RY); if (left != Vector2.zero) { lastLeft = MakeTarget(sequence, wall, wallController, step, drawingPlane, left, step.LS, lastLeft); targetsTotal++; } if (right != Vector2.zero) { lastRight = MakeTarget(sequence, wall, wallController, step, drawingPlane, right, step.RS, lastRight); targetsTotal++; } } } }
void WallCollision(Collider2D collider) { Debug.Log("Collided with wall: "); GameObject scEffect = NewSpawnPool.instance.getGameObject(scoreEffect); scEffect.transform.position = transform.position; // scEffect.AddComponent<Explosion>(); //Destroy(scEffect.GetComponent<DemoReactivator>()); WallController wController = collider.gameObject.GetComponent <WallController>(); wController.Score(); gameObject.SetActive(false); }
public void PrefabPrepareWall(Manager m, WallController wc) { WallPoint point = wc.Position; WallController left = m.House.GetWall(new WallPoint(point.X-1,point.Y)); WallController right = m.House.GetWall(new WallPoint(point.X+1,point.Y)); if(left!=null && right!=null) { wc.wallSprite.Left = true; wc.wallSprite.Right = true; } else { wc.wallSprite.Top = true; wc.wallSprite.Bottom = true; } }
public void PrefabPrepareWall(Manager m, WallController wc) { throw new System.NotImplementedException (); }
private void SetAdjacentWall(WallController wall, Side side) { WallPoint wp = wall.Position; WallPoint adjWallPoint = null; switch(side) { case Side.Bottom: adjWallPoint=new WallPoint(wp.X,wp.Y-1); break; case Side.Left: adjWallPoint=new WallPoint(wp.X-1,wp.Y); break; case Side.Right: adjWallPoint=new WallPoint(wp.X+1,wp.Y); break; case Side.Top: adjWallPoint=new WallPoint(wp.X,wp.Y+1); break; } WallController adjWall = GetWall(adjWallPoint); if(adjWall==null) { if(WallPrefab.PrefabValidatePosition(M,adjWallPoint)) { wall.wallSprite.SetSide(side,true); SetWall(adjWallPoint, WallPrefab); } } else if(adjWall.WallObject==null) { wall.wallSprite.SetSide(side,true); } }
public WallController SetWall(WallPoint point, WallController prefab) { if(point.X<0 || point.Y<0 || point.X>0xffff || point.Y>0xffff) return null; WallController res = null; int key = point.toInt(); if(!walls.ContainsKey(key)) { WallController newWall = Instantiate<WallController>(prefab); newWall.transform.parent = transform; newWall.Position = point; walls.Add(key,newWall); res = newWall; } else res = walls[key]; return res; }
public WallController ReplaceWall(WallPoint point, WallController prefab) { if(point.X<0 || point.Y<0 || point.X>0xffff || point.Y>0xffff) return null; WallController res = null; int key = point.toInt(); if(walls.ContainsKey(key)) { GameObject.Destroy(walls[key].gameObject); walls.Remove(key); } res = SetWall(point, prefab); return res; }
public void PlaceIndicators(Dictionary<int, CellController> cells, Dictionary<int, WallController> walls, WallController wallPrefab) { bool isDoor = wallPrefab.PrefabIsDoor(); foreach(CellController c in cells.Values) { if(c.IsMultiCell) { MapRect rect = c.GetCurCellIndexes(); rect.Foreach((MapPoint p) => { WallPoint wp = new WallPoint(p.X,p.Y); if( (isDoor || !walls.ContainsKey(wp.toInt())) && wallPrefab.PrefabValidatePosition(M,wp)) InstantiateIndicator(wp, isDoor); }); } else { WallPoint wp = new WallPoint(c.Position.X,c.Position.Y); if( (isDoor || !walls.ContainsKey(wp.toInt())) && wallPrefab.PrefabValidatePosition(M,wp)) InstantiateIndicator(wp, isDoor); } } }
private void PlaceWall(HouseController hc, WallPoint p, WallController prefab) { if(hc.GetWall(p)==null) return; hc.EditorRemoveWall(p); WallController w = hc.SetWall(p,prefab); w.EditorUpdateWall(); }
static void createController(WallController controller, String name, int min, int max) { GUILayout.BeginHorizontal("box"); GUILayout.Label("Create " + name); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Left")) controller.createRandomBackground(Vector3.left, Vector3.zero, min, max); if (GUILayout.Button("Right")) controller.createRandomBackground(Vector3.right, Vector3.zero, min, max); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Down")) controller.createRandomBackground(Vector3.zero, Vector3.down, min, max); if (GUILayout.Button("Up")) controller.createRandomBackground(Vector3.zero, Vector3.up, min, max); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
private void createSeriesOfWalls(WallController controller, Vector3 horizontal, Vector3 vertical) { WallController current = controller; for (int i = 0; i < numInstancesToCreate; i++) current = (current.createRandomBackground(horizontal, vertical, 0, nbWallTypes)).GetComponent<WallController>(); }