// Start is called before the first frame update void Awake() { playerInputComponent = GetComponent <PlayerInput>(); playerChecks = GetComponent <PlayerChecks>(); rb = GetComponent <Rigidbody2D>(); aimer = GameObject.Find("Gadget"); }
void DustSpawner() { //This function calls all the other functions to generate dust if (Random.Range(0, 1000) >= 900 && rb.velocity.x != 0 && PlayerInfo.isGrounded) { PlayerChecks.GenerateParticle(dust); } SpeedBackDust(); }
public async void Load(string ID, bool LoadNearPlayer = false) { if (Context.Player == null) { Context.Respond("This is a player only command!"); return; } PlayerChecks User = new PlayerChecks(Context); await HangarCommandSystem.RunTaskAsync(() => User.LoadGrid(ID, LoadNearPlayer), Context); }
private void GroundedUpdate() { if (rb.velocity.y == 0) { PlayerInfo.isGrounded = PlayerChecks.IsGrounded(PlayerInfo.colliderCenter, PlayerInfo.colliderExtents); } else { PlayerInfo.isGrounded = false; } }
public async void Info(string ID = "") { if (Context.Player == null) { Context.Respond("This is a player only command!"); return; } PlayerChecks User = new PlayerChecks(Context); await HangarCommandSystem.RunTaskAsync(() => User.DetailedInfo(ID), Context); }
void SpeedBackDust() { currentVelocity = rb.velocity.x; float difference = currentVelocity - lastVelocity; if ((difference == -maxVelocityDifference || difference == maxVelocityDifference) && PlayerInfo.isGrounded) { PlayerChecks.GenerateParticle(dust); } lastVelocity = currentVelocity; }
public void CallDash(float xRaw, float yRaw) { if (xRaw == 0 && yRaw == 0) { DashMove(PlayerInfo.facing, yRaw); } else { DashMove(xRaw, yRaw); } PlayerChecks.GenerateParticle(dashParticles); }
public async void SaveGrid() { if (Context.Player == null) { Context.Respond("This is a player only command!"); return; } PlayerChecks User = new PlayerChecks(Context); await HangarCommandSystem.RunTaskAsync(() => User.SaveGrid(), Context); }
void Update() { jumpTime += Time.fixedDeltaTime; if (Input.GetKeyDown(KeyCode.Space)) { jumpTime = 0; } if (jumpTime <= minJumpTime && PlayerInfo.isGrounded && PlayerInfo.canJump) { rb.velocity = new Vector2(rb.velocity.x, jumpForce); jumpTime = minJumpTime; PlayerChecks.GenerateParticle(particles); PlayerInfo.isJumping = true; } }
public async void SellGrid(int ID, long price, string description) { if (!Hangar.Config.PluginEnabled) { return; } if (Context.Player == null || !Hangar.Config.GridMarketEnabled) { Context.Respond("This is a player only command!"); return; } PlayerChecks User = new PlayerChecks(Context); await HangarCommandSystem.RunTaskAsync(() => User.SellGrid(ID, price, description), Context); }
void WalkAnim() { float inputX = Input.GetAxisRaw("Horizontal"); bool isColliding = PlayerChecks.WallCollision(PlayerInfo.colliderCenter, PlayerInfo.colliderExtents, inputX); bool needFlip; PlayerInfo.facing = (int)inputX; animator.SetFloat("Speed", Mathf.Abs(inputX)); if (PlayerInfo.isColliding && PlayerInfo.isGrounded && Input.GetAxisRaw("Horizontal") != 0) { AnimPlay("Pushing"); } else if (PlayerInfo.isColliding) { animator.SetFloat("Speed", 0); } needFlip = PlayerInfo.facing == 1 ? false : true; spriteRenderer.flipX = needFlip; }
public async void ListGrids() { PlayerChecks User = new PlayerChecks(Context); await HangarCommandSystem.RunTaskAsync(() => User.ListGrids(), Context); }
public void Remove(int ID) { PlayerChecks User = new PlayerChecks(Context); HangarCommandSystem.RunTask(delegate { User.RemoveGrid(ID); }, Context.Player?.SteamUserId); }
public void Load(int ID, bool LoadNearPlayer = false) { PlayerChecks User = new PlayerChecks(Context); HangarCommandSystem.RunTask(delegate { User.LoadGrid(ID, LoadNearPlayer); }, Context.Player?.SteamUserId); }
public void ListGrids() { PlayerChecks User = new PlayerChecks(Context); HangarCommandSystem.RunTask(delegate { User.ListGrids(); }, Context.Player?.SteamUserId); }
public void Info(int ID = 0) { PlayerChecks User = new PlayerChecks(Context); HangarCommandSystem.RunTask(delegate { User.DetailedInfo(ID); }, Context.Player?.SteamUserId); }
// Start is called before the first frame update void Awake() { playerChecks = GetComponent <PlayerChecks>(); animCharacterComponent = GetComponentInChildren <AnimationComponent>(); rb = GetComponent <Rigidbody2D>(); }
private static void ReceivePacket(ushort HandlerId, byte[] Data, ulong SteamID, bool FromServer) { // Only consider trusted server messages, i.e. from Nexus itself, not untrusted player messages. if (!FromServer) { return; } NexusHangarMessage msg; try { msg = MyAPIGateway.Utilities.SerializeFromBinary <NexusHangarMessage>(Data); } catch (Exception ex) { Log.Error(ex, "Invalid Nexus cross-server message for Quantum Hangar"); return; } switch (msg.Type) { case NexusHangarMessageType.Chat: var chat = new ScriptedChatMsg() { Author = msg.Sender, Text = msg.Response, Font = MyFontEnum.White, Color = msg.Color, Target = msg.ChatIdentityID }; MyMultiplayerBase.SendScriptedChatMessage(ref chat); return; case NexusHangarMessageType.SendGPS: gpsSender.SendGps(msg.Position, msg.Name, msg.EntityID); return; case NexusHangarMessageType.LoadGrid: var chatOverNexus = new Chat((text, color, sender) => { NexusHangarMessage m = new NexusHangarMessage { Type = NexusHangarMessageType.Chat, IdentityID = msg.IdentityID, Response = text, Color = color, Sender = sender, }; API.SendMessageToServer(msg.ServerID, MyAPIGateway.Utilities.SerializeToBinary <NexusHangarMessage>(m)); }); var gpsOverNexus = new GpsSender((position, name, entityID) => { NexusHangarMessage m = new NexusHangarMessage { Type = NexusHangarMessageType.SendGPS, Name = name, Position = position, EntityID = entityID, }; API.SendMessageToServer(msg.ServerID, MyAPIGateway.Utilities.SerializeToBinary <NexusHangarMessage>(m)); }); PlayerChecks User = new PlayerChecks(chatOverNexus, gpsOverNexus, msg.SteamID, msg.IdentityID, msg.PlayerPosition); User.LoadGrid(msg.LoadGridID.ToString(), msg.LoadNearPlayer); return; } Log.Error("Invalid Nexus cross-server message for Quantum Hangar (unrecognized type: " + msg.Type + ")"); }