private void GetManagers() { _ground = gameObject.GetOrAdd <ManagerGroundProbe>(); _health = gameObject.GetOrAdd <ManagerHealth>(); _collision = gameObject.GetOrAdd <ManagerCollision>(); _locomotion = gameObject.GetOrAdd <ManagerLocomotion>(); }
public bool SetCollisionInfos(Collider2D target) { // FIRST, CHECK IF THE TARGET GAMEOBJECT CAN HANDLE COLLISIONS ManagerCollision sourceCollisionManager = GetComponent <ManagerCollision>(); ManagerCollision targetCollisionManager = target.GetComponent <ManagerCollision>(); if (target == null) { return(false); } if (!targetCollisionManager) { return(false); } if (targetCollisionManager && sourceCollisionManager._teamIndex == targetCollisionManager._teamIndex) { return(false); } // SET ALL THE TARGET COLLISION ATTRIBUTES TO REFERENCE THIS OBJECT targetCollisionManager._isColliding = true; targetCollisionManager._lastCollidedObject = transform; // RESET ALL THE TARGET COLLISION ATTRIBUTES ONCE THE INFORMATIONS HAVE BEEN PROCESSED targetCollisionManager.Invoke("EndCollision", 0.2f); return(true); }
public StateHit(Fsm fsm) : base(fsm) { StateDuration = 0.25f; _locomotion = Fsm.gameObject.GetOrAdd <ManagerLocomotion>(); _health = Fsm.gameObject.GetOrAdd <ManagerHealth>(); _collision = Fsm.gameObject.GetOrAdd <ManagerCollision>(); }
private void GetManagers() { _ground = gameObject.GetOrAdd<ManagerGroundProbe>(); _health = gameObject.GetOrAdd<ManagerHealth>(); _collision = gameObject.GetOrAdd<ManagerCollision>(); _locomotion = gameObject.GetOrAdd<ManagerLocomotion>(); }
public StateHit(Fsm fsm) : base(fsm) { StateDuration = 0.25f; _locomotion = Fsm.gameObject.GetOrAdd<ManagerLocomotion>(); _health = Fsm.gameObject.GetOrAdd<ManagerHealth>(); _collision = Fsm.gameObject.GetOrAdd<ManagerCollision>(); }
public void Run(ManagerLogger managerLogger, Server server, NetIncomingMessage inc, PlayerAndConnection playerAndConnection, GameRoom gameRoom) { managerLogger.AddLogMessage("server", "Received new input"); var key = (Keys)inc.ReadByte(); var name = inc.ReadString(); playerAndConnection = gameRoom.Players.FirstOrDefault(p => p.Player.Username == name); if (playerAndConnection == null) { managerLogger.AddLogMessage("server", string.Format("Could not find player with name {0}", name)); return; } int x = 0; int y = 0; switch (key) { case Keys.Down: y++; break; case Keys.Up: y--; break; case Keys.Left: x--; break; case Keys.Right: x++; break; } var player = playerAndConnection.Player; var position = playerAndConnection.Player.Position; if (!ManagerCollision.CheckCollision(new Rectangle(position.XPosition + x, position.YPosition + y, 100, 50), player.Username, gameRoom.Players.Select(p => p.Player).ToList())) { position.XPosition += x; position.YPosition += y; position.Visible = gameRoom.ManagerCamera.InScreenCheck(new Vector2(position.XPosition, position.YPosition)); if (position.Visible) { var screenPosition = gameRoom.ManagerCamera.WorldToScreenPosition(new Vector2(position.XPosition, position.YPosition)); position.ScreenXPosition = (int)screenPosition.X; position.ScreenYPosition = (int)screenPosition.Y; } var command = new PlayerPositionCommand(); command.Run(managerLogger, server, inc, playerAndConnection, gameRoom); } }
void Start() { ManagerCollision launcherCol = Launcher.GetComponent <ManagerCollision>(); if (launcherCol) { _collision.TeamIndex = launcherCol.TeamIndex; } }
void Awake() { _locomotion = gameObject.GetOrAdd<ManagerLocomotion>(); _locomotion.DefaultSpeed = 300f; _collision = gameObject.GetOrAdd<ManagerCollision>(); _collision.Damages = 1; Grid.particleSystem.Play("ball", transform, transform.right, true); }
void Awake() { _locomotion = gameObject.GetOrAdd <ManagerLocomotion>(); _locomotion.DefaultSpeed = 300f; _collision = gameObject.GetOrAdd <ManagerCollision>(); _collision.Damages = 1; Grid.particleSystem.Play("ball", transform, transform.right, true); }