void Awake() { kf = GetComponent <KeyboardFunctions>(); grid = GetComponent <Grid>(); bhandler = GetComponent <BuildHandler> (); bank = GetComponent <Bank>(); pathfind = GetComponent <PathFind>(); pn = GetComponent <PlayerNetworking> (); wallGhostLoaded = (GameObject)(Resources.Load("Walls/WallGhost")); wallIcon = Resources.Load <Sprite> ("Sprites/WallIcon"); orbIcon = Resources.Load <Sprite> ("Sprites/OrbIcon"); cannonIcon = Resources.Load <Sprite> ("Sprites/CannonIcon"); laserIcon = Resources.Load <Sprite> ("Sprites/LaserIcon"); iceIcon = Resources.Load <Sprite> ("Sprites/IceIcon"); lightIcon = Resources.Load <Sprite> ("Sprites/LightIcon"); magicIcon = Resources.Load <Sprite> ("Sprites/MagicIcon"); rangeIndicator = (GameObject)(Resources.Load("UI/RangeIndicator")); highlightCastleMaterial = (Material)(Resources.Load("Materials/Outlined_Object")); BuildFX = (AudioClip)(Resources.Load("Sounds/BuildingPlacement", typeof(AudioClip))); needMoneySound = (AudioClip)(Resources.Load("Sounds/needMoney", typeof(AudioClip))); cannotBuildSound = (AudioClip)(Resources.Load("Sounds/CannotBuild", typeof(AudioClip))); selectSound = Resources.Load <AudioClip> ("Sounds/CarDoorClose"); sourceSFX = Camera.main.GetComponent <AudioSource>(); }
public void Update(KeyboardState keystate) { // Swap the states and update the current keys this._previousKeyboard = _currentKeyboard; this._currentKeyboard = keystate; this._pressedKeys = KeyboardFunctions.CurrentPressedKeys(_pressedKeys, _currentKeyboard, _previousKeyboard); // Now test for all possible movements this.CallToAction(_pressedKeys); }
public void Update(float delta, KeyboardState nextState) { this._previousKeyboard = this._currentKeyboard; this._currentKeyboard = nextState; // These are the actual honest to goodness pressed keys. // that were not pressed before. _pressedKeys = KeyboardFunctions.CurrentPressedKeys(_pressedKeys, _currentKeyboard, _previousKeyboard); MovementFireActions(_pressedKeys, this._movingActions); GeneralFireActions(_pressedKeys, this._firingActions); GeneralFireActions(_pressedKeys, this._specialActions); UnpressedActions(_pressedKeys, this._unpressedActions); }
void Update() { if (myPlayer == null) { myPlayer = gm.MyLocalPlayer(); } else { if (kf == null) { kf = myPlayer.GetComponent <KeyboardFunctions> (); } } }
protected override void Update(GameTime gameTime) { // abort var kState = Keyboard.GetState(); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || kState.IsKeyDown(Keys.Escape)) { Exit(); } var delta = (float)gameTime.ElapsedGameTime.TotalSeconds; var keys = KeyboardFunctions.CurrentPressedKeys(kState.GetPressedKeys(), kState, pKState); this._keyboard4Way.Update(gameTime, kState, new GamePadState()); this.fourway.Update(delta); backgroundMap.Update(gameTime); pKState = kState; }
protected override void Update(GameTime gameTime) { // abort var kState = Keyboard.GetState(); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || kState.IsKeyDown(Keys.Escape)) { Exit(); } var delta = (float)gameTime.ElapsedGameTime.TotalSeconds; var keys = KeyboardFunctions.CurrentPressedKeys(kState.GetPressedKeys(), kState, pKState); rotator.Update(delta); _keyboardRotator.Update(gameTime, kState, GamePadState.Default); _foregroundLayter.Update(gameTime); _foregroundLayter2.Update(gameTime); pKState = kState; }
void Update() { if (myPlayer == null) { myPlayer = gm.MyLocalPlayer(); } else { if (kf == null) { kf = myPlayer.GetComponent <KeyboardFunctions> (); } if (mf == null) { mf = myPlayer.GetComponent <MouseFunctions> (); } if (bhandler == null) { bhandler = myPlayer.GetComponent <BuildHandler> (); } } if (runTimer == true) { buttonHoldTime += Time.deltaTime; if (buttonHoldTime >= buttonThresholdTime) { SellSelected(); runTimer = false; buttonHoldTime = 0; } } }
void Awake() { //Set References //============================================================ kf = GetComponent <KeyboardFunctions> (); mf = GetComponent <MouseFunctions> (); bank = GetComponent <Bank>(); pn = GetComponent <PlayerNetworking> (); //Pre-load Objects //============================================================ //Walls wall2Way = (GameObject)(Resources.Load("Walls/Wall2Way")); wall3Way = (GameObject)(Resources.Load("Walls/Wall3Way")); wall4Way = (GameObject)(Resources.Load("Walls/Wall4Way")); wallEnd = (GameObject)(Resources.Load("Walls/WallEnd")); wallCorner = (GameObject)(Resources.Load("Walls/WallCorner")); wallSolo = (GameObject)(Resources.Load("Walls/WallSolo")); wallFloorOpen = (GameObject)(Resources.Load("Walls/WallDoorOpen")); wallFloorClose = (GameObject)(Resources.Load("Walls/WallDoorClose")); //Towers orbTower = (GameObject)(Resources.Load("Towers/BasicOrbTower")); cannonTower = (GameObject)(Resources.Load("Towers/CannonTower")); laserTower = (GameObject)(Resources.Load("Towers/LaserTower")); iceTower = (GameObject)(Resources.Load("Towers/IceTower")); lightTower = (GameObject)(Resources.Load("Towers/LightTower")); magicTower = (GameObject)(Resources.Load("Towers/MagicTower")); //Audio References sourceSFX = Camera.main.GetComponent <AudioSource> (); needMoneySound = (AudioClip)(Resources.Load("Sounds/needMoney", typeof(AudioClip))); cannotBuildSound = (AudioClip)(Resources.Load("Sounds/CannotBuild", typeof(AudioClip))); }