// Start is called before the first frame update void Start() { isComplete = false; isGameOver = false; killCount = 0; if (PlayerPrefs.HasKey("CurrentGems")) { gemCount = PlayerPrefs.GetInt("CurrentGems"); } else { gemCount = 0; } gemText.text = gemCount.ToString(); if (PlayerPrefs.HasKey("CurrentLevel")) { currentLevel = PlayerPrefs.GetInt("CurrentLevel"); } else { currentLevel = 1; } playerController = FindObjectOfType <PlayerController>(); levelPortal = FindObjectOfType <LevelPortal>(); waveSpawner = FindObjectOfType <WaveSpawner2>(); weaponSwitching = FindObjectOfType <WeaponSwitching>(); crosshair = FindObjectOfType <Crosshair>(); updateKillGoal(); killText.text = killCount.ToString() + "/" + killGoal.ToString(); killText.color = Color.white; }
public static void SetProcess(string text, float time) { Vote.voteprocess = true; Vote.votetext = text; Vote.voteendtime = time; Crosshair.SetActive(false); }
void Update() { direction = new Vector2(playerInput.Vertical, playerInput.Horizontal); MoveControl3.Move(direction, playerInput.Jumped); mouseInput.x = Mathf.Lerp(mouseInput.x, playerInput.MouseInput.x, 1f / MouseControl.Damping.x); mouseInput.y = Mathf.Lerp(mouseInput.y, playerInput.MouseInput.y, 1f / MouseControl.Damping.y); transform.Rotate(Vector3.up * mouseInput.x * MouseControl.Sensitivity.x); currCharacter.specialMovement.TakeInput(); Crosshair.LookHeight(mouseInput.y * MouseControl.Sensitivity.y); if (playerInput.Fire1) { currCharacter.pulseBlastShooter.Fire(); } if (playerInput.ActivatableItem) { CharacterInventory.switchCharacter(0); } if (playerInput.CharacterInventoryOpen) { CharacterInventory.ShowInventory(); } if (playerInput.TestButton) { CharacterInventory.switchCharacter(1); } }
// Start is called before the first frame update void Start() { Debug.Log("Called Start function"); //Set references rigidBody = GetComponent <Rigidbody2D> (); cameraController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController> (); animator = GetComponent <Animator> (); //Set starting stats currentHp = maxHp; currentStamina = maxStamina; currentMoveSpeed = moveSpeed; if (photonView.IsMine == true) { //Follow with camera cameraController.startFollowing(gameObject); //Link to UI elements healthBar = GameObject.FindGameObjectWithTag("HealthBar"); staminaBar = GameObject.FindGameObjectWithTag("StaminaBar"); //Spawn crosshair GameObject crosshairObj = Instantiate(crosshairPrefab, Vector3.zero, Quaternion.identity); crosshair = crosshairObj.GetComponent <Crosshair> (); } }
internal void SetControllerNumber(int number) { controllerNumber = number; horizontalAxis = "J" + controllerNumber + "Horizontal"; verticalAxis = "J" + controllerNumber + "Vertical"; horizontalRightAxis = "J" + controllerNumber + "RightHorizontal"; verticalRightAxis = "J" + controllerNumber + "RightVertical"; aButton = "J" + controllerNumber + "A"; xButton = "J" + controllerNumber + "X"; rightTriggerButton = "J" + controllerNumber + "RightTrigger"; startButton = "J" + controllerNumber + "Start"; // Set all controls GameObject PCBinding = GameObject.Find("PCBinding"); ControllerPlayerBinding cpBinding = PCBinding.GetComponent <ControllerPlayerBinding>(); Crosshair player_tank_crosshair_script = player_tank_crosshair.GetComponent <Crosshair>(); if (cpBinding.getControllerBinding(tank_number) == 5) { isKeyboard = true; } player_tank_crosshair_script.SetCrosshairControls(horizontalRightAxis, verticalRightAxis, isKeyboard); player_tank_gun_script = player_tank_gun.GetComponent <PlayerGun>(); print(player_tank_gun_script); player_tank_gun_script.SetGunController(xButton, rightTriggerButton); }
void Start() { //audioManager = FindObjectOfType<AudioManager>(); levelManager = FindObjectOfType <LevelManager>(); playerController = FindObjectOfType <PlayerController>(); crosshair = FindObjectOfType <Crosshair>(); }
public virtual bool SetupCrossHair() { bool continute_setup = true; AlertProgress("Checking Crosshair Dependencies"); Crosshair crosshair = camera.GetComponent <Crosshair>(); if (crosshair) { AlertProgress("Crosshair Found"); SetupCrossHairDefaults(crosshair); continute_setup = true; } else { AlertProgress("Crosshair not found"); AlertProgress("Creating Crosshair"); crosshair = camera.AddComponent <Crosshair>(); SetupCrossHairDefaults(crosshair); continute_setup = true; } AlertProgress("Crosshair Setup complete"); return(continute_setup); }
void Start() { gunParticle = GetComponent <ParticleSystem>(); theCrosshair = FindObjectOfType <Crosshair>(); gunLine = GetComponent <LineRenderer>(); gunLight = GetComponent <Light>(); }
private Crosshair cs;// = new Crosshair(); public MyGame() : base(1920, 1080, false) { gd = new GunDude(); gm = new GameManager(); border = new Border(); background = new Background(); smoke = new Smoke(); lights = new Lights(); cs = new Crosshair(); hud = new HUD(); player = new Player(); builder = new WaveBuilder(); topBuilder = new TopWaveBuilder(); startScreen = new StartScreen(); gameOver = new GameOver(); gameObjs.Add(border); gameObjs.Add(background); gameObjs.Add(smoke); gameObjs.Add(lights); gameObjs.Add(cs); gameObjs.Add(hud); gameObjs.Add(player); gameObjs.Add(gd); builder.WaveSpawner(); topBuilder.WaveSpawner(); }
private void Awake() { anim = GetComponent <Animator>(); cameraController = FindObjectOfType <CameraController>(); crosshair = FindObjectOfType <Crosshair>(); gun = GetComponentInChildren <Gun>(); }
private void Start() { crosshair = GetComponent <Crosshair>(); //Cursor locked on center and invisible Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
public void StartFade(Color crosshairColor, Crosshair crosshair) { _readyToFade = true; _startTime = Time.time; _spriteRenderer.color = crosshairColor; _crosshair = crosshair; }
void Awake() { animator = GetComponentInChildren <Animator>(); inputController = GameManager.Instance.inputController; chest = animator.GetBoneTransform(HumanBodyBones.Spine); crosshair = GetComponentInChildren <Crosshair>(); }
public override void LayoutSubviews() { base.LayoutSubviews(); MapView.SetFrame(0, 0, Frame.W, Frame.H); Popup.Frame = new CGRect(0, 0, Frame.W, Frame.H); int w = (int)(58 * Density); int h = w; int x = Frame.W - (w + padding); int y = Frame.H - (h + padding); Add.Frame = new CGRect(x, y, w, h); Done.Frame = new CGRect(x, y, w, h); Cancel.Frame = new CGRect(x, y, w, h); doneVisiblePosition = Done.Frame.X - (Done.Frame.W + padding); doneHiddenPosition = Done.Frame.X; x = MapView.LayoutParameters.Width / 2 - w / 2; y = MapView.LayoutParameters.Height / 2 - h / 2; Crosshair.SetFrame(x, y, w, h); int smallPad = padding / 2; w = (int)(Frame.W / 2.5); h = (int)(w * 1.3); x = Frame.W - (w + smallPad); y = smallPad; Attachment.Frame = new CGRect(x, y, w, h); }
public void Component(ObjectManager _objectManager, Transform _crosshair) { audioManager = AudioManager.instance; gameManager = GameManager.instance; objectManager = _objectManager; crosshair = _crosshair.GetComponent <Crosshair>(); }
// Use this for initialization void Start() { //soundevent = FMODUnity.RuntimeManager.CreateInstance(selectSound); GameObject mainCamera = GameObject.Find("MainCamera"); _crosshair = mainCamera.GetComponent <Crosshair>(); }
public PlayingGameState() { DifficultySettings.SetDifficulty(DifficultyEnum.Easy); _crosshair = new Crosshair(); _background = new Background(); _fps = new FontRender("fps counter"); _fps.LoadContent("default"); _fps.Location = new Vector2(40, Engine.ScaledViewPort.Y - 50); _score = new ScoreBoard("score board"); _hud = new Hud("Hud"); _levelController = new LevelController(new LevelBuilder().Levels); NextLevel(); _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _hud); _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background); _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _fps); _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _score); _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _billboard); _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair); Channels.AddNewChannel("score"); Channels.AddNewChannel("duckhit"); Channels.AddNewChannel("gunfired"); _billboard.StartBillBoard("Level " + _levelController.LevelNumber); }
void Start() { healthBar = FindObjectOfType <HealthBar>(); dashBar = FindObjectOfType <DashBar>(); myRigidBody = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); crosshair = FindObjectOfType <Crosshair>(); spriteRenderer = GetComponent <SpriteRenderer>(); levelManager = FindObjectOfType <LevelManager>(); audioManager = FindObjectOfType <AudioManager>(); //pauseMenu = FindObjectOfType<PauseMenu>(); healthBar.SetMaxHealth(maxHealth); if (PlayerPrefs.HasKey("CurrentHealth") && PlayerPrefs.GetFloat("CurrentHealth") > 0) { currentHealth = PlayerPrefs.GetFloat("CurrentHealth"); healthBar.SetHealth(currentHealth); Debug.Log("Active"); } else { currentHealth = maxHealth; } currentCharge = maxCharge; dashBar.SetCharge(maxCharge); invincible = false; }
public MouseTracker() { InitializeComponent(); wpfPlot1.Plot.AddSignal(DataGen.RandomWalk(null, 100)); Crosshair = wpfPlot1.Plot.AddCrosshair(0, 0); wpfPlot1.Refresh(); }
public override void OnHoverEnter(GameObject player) { base.OnHoverEnter(player); Crosshair.SetAlpha(1f); UiController.Instance.SetItemDescription(name); }
public override void OnStart() { base.OnStart(); if (isOwner) { hudWeaponIcon = uiObject.Find("Icon").GetComponent <Image>(); hudWeaponAmmo = uiObject.Find("Ammo").GetComponent <Text>(); crosshair = GameObject.Find("Crosshair").GetComponent <Crosshair>(); } barrelEnd = weaponObject.Find("BarrelEnd"); if (barrelEnd == null) { Debug.LogError("Gun::OnStart - Missing 'BarrelEnd'"); } animator = weaponObject.GetComponent <Animator>(); if (animator != null) { animator.SetFloat("ReloadTime", 1f / reloadTime); } audioSource = weaponHolder.GetComponent <AudioSource>(); ammo = Instantiate(ammo); //ammo.Load(this); UpdateHudWeapon(); EndReload(); }
public void UpdateATL(ThirdPersonUserControl player, CurvySpline spline, Crosshair crosshair) { if (!init && spline.IsInitialized) { init = true; } if (!init) { return; } Vector3 theCenter = Vector3.zero; Vector3 theVelocity = Vector3.zero; flockSize = _boids.Count; // transform.position = player.transform.position + Camera.main.transform.forward * 10.0f; for (int i = 0; i < _boids.Count; i++) { theCenter += _boids [i].transform.position; theVelocity += _boids [i].GetComponent <Rigidbody> ().velocity; } flockCenter = theCenter / flockSize; //AxKDebugLines.AddFancySphere(flockCenter, 1f, Color.red, 0); flockVelocity = theVelocity / flockSize; //AxKDebugLines.AddLine(flockCenter, flockCenter + flockVelocity, Color.red, 0); for (int i = 0; i < _boids.Count; i++) { _boids[i].GetComponent <BoidFlocking> ().UpdateATL(_boids, this, player, spline, crosshair); } }
public void OnStart(SceneContext ec, Scene previous = null) { Console.WriteLine("start"); Random r = new Random(); Entity test = null; //for (int i = 0; i < 5; i++) //{ double x = r.Next(100); double y = r.Next(100); string concat = "{'x':" + x + ",'y':" + y + ", 'type':'test', 'rotation':5,'material':{'type':'SimpleTexturedMaterial','textureName':'table'},'mesh':{'type':'QuadMesh','width':12.0,'height':8.0},attributes:[{'type':'ActorData','speed':1,'rotationspeed':20,'speedmultiplicator':1.2,'maxspeed':0.005}],behaviours:['MovementInputHandlerBehaviour']}"; EntityDefinition asd = JsonConvert.DeserializeObject <EntityDefinition>(concat); test = EntityFactory.Instance.Generate(asd); EntityFactory.Instance.GenerateByName("TEST_WEAPON", (float)x, (float)y + 5); //} InputConfig ic = InputConfig.Instance; Crosshair ch = new Crosshair( new Axis[] { ic.MOUSE, ic.RIGHT_AXIS }, ic.LEFT_MOUSE, ic.RIGHT_MOUSE, test, this.worldManager.World) { CursorSensitivity = 10, CursorRange = 50, CursorSize = 5, CursorImage = ec.SceneResourceManager.GetTexture("crosshair") }; this.camera.TrackingBody = ch.Sensor; ec.Hud.Add(ch); // test = EntityFactory.Instance.Generate(asd); }
private void Awake() { Current = this; var canvas = GetComponent<Canvas>(); canvas.worldCamera = Camera.main; SetEnabled(true); }
public override void OnHoverExit(GameObject player) { base.OnHoverExit(player); Crosshair.ResetAlpha(); UiController.Instance.SetItemDescription(""); }
protected override void Fire() { if (this.AnimationFire == string.Empty) { this.AnimationFire = "Shot"; } Crosshair.SetOffsetInc(8); this.m_LastFireTime = Time.time; if (this.AnimationFire != string.Empty) { if (!this.m_FPSCamera.inZoom() || this.m_FPSWeapon.WeaponSlot != 1) { this.m_FPSWeapon.WeaponCoreModel.GetComponent <Animation>().Stop(this.AnimationFire); this.m_FPSWeapon.WeaponCoreModel.GetComponent <Animation>().Play(this.AnimationFire); } } if (this.MotionRecoilDelay == 0f) { this.ApplyRecoil(); } else { vp_Timer.In(this.MotionRecoilDelay, new vp_Timer.Callback(this.ApplyRecoil), null); } base.Fire(); if (!SpecCam.show) { Client.cs.send_attack(); } this.m_FPSWeapon.SetMuzzleLight(); }
void Start() { moveComponent = this.GetComponent <PlayerMovement>(); aimComponent = this.GetComponent <Crosshair>(); attackComponent = this.GetComponent <AttackComponent>(); health = GetComponent <Health>(); energy = GetComponent <Energy>(); doubleTapTime = 1f; timeSinceLastTap_W = doubleTapTime; timeSinceLastTap_S = doubleTapTime; timeSinceLastTap_A = doubleTapTime; timeSinceLastTap_D = doubleTapTime; if (health != null) { health.OnDeath += OnDeath; } GameObject managerObject = GameObject.FindGameObjectWithTag("Manager"); if (managerObject != null) { gameMenuManager = managerObject.GetComponent <GameMenuManager>(); } }
private static void FPMove() { if (!SpecCam.show) { return; } if (SpecCam.FID >= 0) { if (PlayerControll.Player[SpecCam.FID] == null) { SpecCam.FID = -1; } else if (PlayerControll.Player[SpecCam.FID].go == null) { SpecCam.FID = -1; } } if (SpecCam.FID < 0) { return; } PlayerControll.Player[SpecCam.FID].go.SetActive(false); vp_FPController.cs.SetPosition(PlayerControll.Player[SpecCam.FID].currPos); Crosshair.SetOffsetNull(); if (Time.time > SpecCam.FireTime) { vp_FPInput.cs.Player.Attack.TryStop(); } }
public override void Enter(Dictionary<string, object> data) { var localPlayer = Storage.NetworkSession.LocalGamers[0].Tag as LocalPlayer; if(localPlayer != null) { localPlayer.Phase = GamePhases.Phase1; } _tutorialSound = Storage.Sound("Tutorial").CreateInstance(); Storage.InTutorial = true; Storage.TutorialLevel = 0; Cursor.Hide(); _crosshair = new Crosshair(Game); Game.Components.Add(_crosshair); foreach(var gamer in Storage.NetworkSession.AllGamers) { Game.Components.Add((Player)gamer.Tag); } Game.Components.Add(Game.GameMap); if(localPlayer != null) { var centerSidebar = (Game.GameMap.Width + Game.BaseScreenSize.X) / 2.0f; _mobilityIcon = AddToolIconForTool(localPlayer.Mobility, centerSidebar - 20.0f - 148.0f, 10.0f + 148.0f); _weaponIcon = AddToolIconForTool(localPlayer.Weapon, centerSidebar, 10.0f + 148.0f); _utilityIcon = AddToolIconForTool(localPlayer.Utility, centerSidebar + 20.0f + 148.0f, 10.0f + 148.0f); _primaryAIcon = AddToolIconForTool(localPlayer.PrimaryA, centerSidebar - 10.0f - 74.0f, (10.0f + 148.0f) * 2.0f); _primaryBIcon = AddToolIconForTool(localPlayer.PrimaryB, centerSidebar + 20.0f + 74.0f, (10.0f + 148.0f) * 2.0f); _keyBindingIcon = new Billboard(Game, (int)centerSidebar, 400, Storage.Sprite("blank")) { PositionGravity = Gravity.Center }; Game.Components.Add(_keyBindingIcon); if(_primaryBIcon != null) { _primaryBIcon.Disabled = true; } _nameLabel = new Label(Game, centerSidebar, 2.0f, localPlayer.Gamer.Gamertag, "Calibri48Bold") { PositionGravity = new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Top, Gravity.Horizontal.Center) }; Game.Components.Add(_nameLabel); } Game.Components.Add(Storage.SandParticles); StartTimer(); }
// Start is called before the first frame update void Start() { Cursor.visible = false; /* * TextMeshPro tmp = truthBulletPrefab.GetComponentInChildren<TextMeshPro>(); * tmp.SetText(truthBullets[0]); * tmp.ForceMeshUpdate(); * float width = tmp.textBounds.size.x; * foreach (Transform child in tmp.transform) * { * if (child.name == "Center") child.localScale *= width; * else if (child.name == "Tip") child.localPosition *= width; * } */ myaMaxX = -myaObject.transform.localPosition.x; gunCornerPosition = gunObject.transform.localPosition; gunObject.transform.localPosition = new Vector3(gunMinX, 0, 0); gunObject.transform.localScale *= gunScaleMult; gunRotZ = gunObject.transform.localEulerAngles.z; foreach (Transform child in gunObject.transform) { if (child.name == "Outer") { gunOuterRing = child; gunOuterRing.localScale *= gunScaleMult; } else if (child.name == "Cylinder") { gunCylinder = child; } } foreach (GameObject bullet in truthBullets) { bullet.transform.localPosition += new Vector3(1000, 0, 0); } bulletScale = truthBullets[0].transform.localScale; text = GetComponentsInChildren <NonstopDebateText>(true); foreach (var t in text) { t.gameObject.SetActive(false); } //NextText(); timer = 0; crosshair = cursor.GetComponent <Crosshair>(); cursor.SetActive(false); camSlide = transform.parent; camLookAt = camSlide.parent; camRandomOffset = camLookAt.parent; camMainRotator = camRandomOffset.parent; shotText.GetComponent <ShotText>().trigger += ShotTextHit; }
void OnMouseDown() /* TODO(Ian): Write a method string here. */ { //This function is called by Unity when a collider is clicked mouse.OnMove += LookAt; mouse.OnLeftClickUp += FireHandler; currentCrosshair = GameObject.Instantiate(crosshairPrefab.gameObject).GetComponent<Crosshair>(); }
void Awake() { if(instance != null) { Debug.LogError("Crosshair instance already exist"); } instance = this; }
public MouseTracker() { InitializeComponent(); formsPlot1.Plot.AddSignal(DataGen.RandomWalk(null, 100)); Crosshair = formsPlot1.Plot.AddCrosshair(0, 0); formsPlot1_MouseLeave(null, null); lblMouse.Text = "Mouse has yet to enter the plot..."; }
private void OnResize() { Vector2 vector = new Vector2((float)Screen.width, (float)Screen.height) / 2f; int num = (int)GUI2.YRES(32f); this.rCrosshaitHit = new Rect(vector.x - (float)num / 2f, vector.y - (float)num / 2f, (float)num, (float)num); Crosshair.CalcResize(); }
public override void Initialize() { // TODO: Add your initialization logic here ranks = new RankManager(); crosshair = new Crosshair(game.Content); h1 = new HUD(); d1 = new DropBoxManager(game.Content); b1 = new background(); cam = new CameraMan(new Vector2(0, 0)); cam._pos.Y += service.GraphicsDevice.PresentationParameters.BackBufferHeight / 2; cam._pos.X += service.GraphicsDevice.PresentationParameters.BackBufferWidth / 2; }
public SpawnDrop spawnDrop; //where player starts the game #endregion Fields #region Methods void Awake() { jgs = GameObject.FindGameObjectWithTag(TagsAndLayers.gameController).GetComponent<JumpGameState>(); musicController = GameObject.FindGameObjectWithTag(TagsAndLayers.musicController).GetComponent<MusicController>(); gameTimer = GameObject.FindGameObjectWithTag(TagsAndLayers.gameTimer).GetComponent<GameTimer>(); deathArea = GameObject.FindGameObjectWithTag(TagsAndLayers.deathArea).GetComponent<DeathArea>(); spawnDrop = GameObject.FindGameObjectWithTag(TagsAndLayers.spawnDrop).GetComponent<SpawnDrop>(); menuScreen = GameObject.FindGameObjectWithTag(TagsAndLayers.menuController).GetComponent<MenuScreen>(); pause = Camera.main.GetComponent<Pause>(); crosshair = Camera.main.GetComponent<Crosshair>(); objectSpawners = GameObject.FindGameObjectsWithTag(TagsAndLayers.objectSpawner); jumppadPillars = GameObject.FindGameObjectsWithTag(TagsAndLayers.jumppadPillar); player = GameObject.FindGameObjectWithTag(TagsAndLayers.player); }
void Start() { player = GameObject.FindGameObjectWithTag ("Player"); //crosshair = GameObject.FindGameObjectWithTag ("Crosshair"); crosshairScript = player.GetComponent<Crosshair> (); backgroundMusic = GameObject.FindGameObjectWithTag ("BackgroundMusic").GetComponent<AudioSource> (); zoomMusic = GetComponent<AudioSource> (); //player.GetComponentInParent<AudioSource> (); }
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { if(phase == Phase.Begin) { if(singlePlayer) { gameStart = gameTime.TotalGameTime; phase = Phase.Main; } else if(!synced) { Sync((JArray data, double random) => { gameStart = gameTime.TotalGameTime; phase = Phase.Main; }); synced = true; } } else if(phase == Phase.Main) { // randomly drop paint on the canvas if(singlePlayer) { if(rand.Next(0, 1000) < 20 - 3 * upgrades[(int)Upgrade.EnemyFreq]) { Splatter splatter = new Splatter(this, players[""], rand); splatter.Scale = (float)rand.NextDouble() + 1; players[""].StartThrow(splatter); players[""].ThrowPaint(gameTime.TotalGameTime - gameStart, new Vector2(rand.Next(BOUNDS.Left, BOUNDS.Right), rand.Next(BOUNDS.Top, BOUNDS.Bottom))); } } if(gameTime.TotalGameTime - gameStart > PAINT_TIME) { Dictionary<Color, float> areas = CalculatePaint(); foreach(Avatar a in players.Values) { a.score = areas[a.color] / (BOUNDS.Width * BOUNDS.Height); } gameEnd = gameTime.TotalGameTime; banner = new TextBanner(this, "TIME'S UP"); foreach(Avatar a in players.Values) { if(a.currentPaint != null) { RemoveActor(a.currentPaint); splatters.Remove(a.currentPaint); a.currentPaint = null; a.State = AvatarStates.Standing; } } if(crosshair != null) { RemoveActor(crosshair); crosshair = null; } if(singlePlayer) { score = (int)(players[playerName].score * 10000); } phase = Phase.Calculation; } } else if(phase == Phase.Calculation) { if(gameTime.TotalGameTime - gameEnd > BANNER_TIME + BANNER_TIME + SCORE_TIME) { if(singlePlayer) { phase = Phase.Limbo; } else { // Sync scores JObject packet = new JObject( new JProperty("action", "group"), new JProperty("type", "report_score"), new JProperty("score", new JObject( from username in players.Keys select new JProperty(username, (int)(players[username].score * -10000)) )) ); conn.SendMessage(packet.ToString()); phase = Phase.Limbo; } } else if(gameTime.TotalGameTime - gameEnd > BANNER_TIME + SCORE_TIME) { banner = singlePlayer ? banner ?? new TextBanner(this, "Score: " + score) : banner ?? new TextBanner(this, "GAME OVER"); } else if(gameTime.TotalGameTime - gameEnd > BANNER_TIME) { banner = null; } } else if(phase == Phase.Limbo) { // Do nothing } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); }
private void Awake() { instance = this; }
void Start() { crosshair = GetComponent<Crosshair> (); middleCrosshairInst = Instantiate (middleCrosshair, GetPosition (distance), Quaternion.identity) as GameObject; }
public override void Enter(Dictionary<string, object> data) { var localPlayer = Storage.NetworkSession.LocalGamers[0].Tag as LocalPlayer; if(localPlayer != null) { localPlayer.Phase = GamePhases.Phase1; } Cursor.Hide(); _crosshair = new Crosshair(Game); Game.Components.Add(_crosshair); foreach(var gamer in Storage.NetworkSession.AllGamers) { Game.Components.Add((Player)gamer.Tag); } Game.Components.Add(Game.GameMap); if(localPlayer != null) { var centerSidebar = (Game.GameMap.Width + Game.BaseScreenSize.X) / 2.0f; _mobilityIcon = AddToolIconForTool(localPlayer.Mobility, centerSidebar - 20.0f - 148.0f, 10.0f + 148.0f); _weaponIcon = AddToolIconForTool(localPlayer.Weapon, centerSidebar, 10.0f + 148.0f); _utilityIcon = AddToolIconForTool(localPlayer.Utility, centerSidebar + 20.0f + 148.0f, 10.0f + 148.0f); _primaryAIcon = AddToolIconForTool(localPlayer.PrimaryA, centerSidebar - 10.0f - 74.0f, (10.0f + 148.0f) * 2.0f); _primaryBIcon = AddToolIconForTool(localPlayer.PrimaryB, centerSidebar + 20.0f + 74.0f, (10.0f + 148.0f) * 2.0f); if(_primaryBIcon != null) { _primaryBIcon.Disabled = true; } _nameLabel = new Label(Game, centerSidebar, 2.0f, localPlayer.Gamer.Gamertag, "Calibri48Bold") { PositionGravity = new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Top, Gravity.Horizontal.Center) }; Game.Components.Add(_nameLabel); } Game.Components.Add(Storage.SandParticles); _redSandMeter = new SandMeter(Game, Team.Red) { X = _primaryAIcon.X, Y = _primaryAIcon.Y + 430 }; _blueSandMeter = new SandMeter(Game, Team.Blue) { X = _primaryBIcon.X, Y = _primaryBIcon.Y + 430 }; Game.Components.Add(_redSandMeter); Game.Components.Add(_blueSandMeter); _redScoreMeter = new ScoreMeter(Game, Team.Red) { X = _redSandMeter.X, Y = _redSandMeter.Y + (_redSandMeter.Height / 2.0f) + 85 }; _blueScoreMeter = new ScoreMeter(Game, Team.Blue) { X = _blueSandMeter.X, Y = _blueSandMeter.Y + (_blueSandMeter.Height / 2.0f) + 85 }; Game.Components.Add(_redScoreMeter); Game.Components.Add(_blueScoreMeter); StartTimer(); }
void Awake() { instance = this; }
public override void HandleInput(GameTime gameTime, InputState input) { // launch the paintball if(input.TouchState.Count == 0) { if(crosshair != null && !crosshair.blinking) { players[playerName].ThrowPaint(gameTime.TotalGameTime + BLINK_TIME - gameStart, crosshair.Coord); crosshair.Blink(BLINK_TIME, gameTime.TotalGameTime); if(!singlePlayer) { // let others know you threw paint JObject packet = new JObject( new JProperty("action", "game"), new JProperty("name", "color_clash"), new JProperty("data", new JObject( new JProperty("action", "paint"), new JProperty("x_pos", crosshair.Coord.X), new JProperty("y_pos", crosshair.Coord.Y), new JProperty("time", (gameTime.TotalGameTime + BLINK_TIME - gameStart).Ticks), new JProperty("scale", players[playerName].currentPaint.Scale) )) ); conn.SendMessage(packet.ToString()); } } } else if(phase == Phase.Main) { foreach(TouchLocation loc in input.TouchState) { Vector2 scaledPos = Helpers.ScaleInput(new Vector2(loc.Position.X, loc.Position.Y)); if(crosshair == null) { crosshair = new Crosshair(this, scaledPos); players[playerName].StartThrow(); } else { if(!crosshair.blinking) crosshair.MoveCrosshair(scaledPos); } } } base.HandleInput(gameTime, input); }
public void ChangeCrosshair(){ activeCrosshair = GameObject.FindGameObjectWithTag ("CrosshairManager").GetComponent<CrosshairManager>().activeCrosshair; }
void Start() { audioSourceMngr = GetComponent<AudioSourceManager>(); timer = timerStart; foreach(GameObject go in GameObject.FindGameObjectsWithTag("Guest")) { guestCount += 1; guests.Add(go); } foodMeterStart = foodMeter; foodMeter = greaseLevel; foodEatInterval = foodMeter/ (foodMeterStart); uiRootInst = Instantiate(uiRoot, new Vector3(9999,9999,9999), uiRoot.transform.rotation) as GameObject; foodbarSprite = uiRootInst.GetComponentInChildren<UISprite>(); foodbarSprite.color = topColor; camShake = GetComponent<CameraShake>(); cam = Camera.main.transform; foodParticleInst = Instantiate(foodParticle, cam.transform.position + new Vector3(cam.transform.forward.x, cam.transform.forward.y - 0.5f, cam.transform.forward.z), foodParticle.transform.rotation) as GameObject; foodParticleSystem = foodParticleInst.GetComponent<ParticleSystem>(); crosshair = cam.GetComponent<Crosshair>(); comboCounterGui = uiRootInst.transform.Find("ComboCount").gameObject.GetComponent<UILabel>(); goldCounterGui = uiRootInst.transform.Find("GoldCount").gameObject.GetComponent<UILabel>(); goldCounterGui = uiRootInst.transform.Find("GoldCount").gameObject.GetComponent<UILabel>(); timerGui = uiRootInst.transform.Find("Time").gameObject.GetComponent<UILabel>(); gameOverGui = uiRootInst.transform.Find("GameOver").gameObject.GetComponent<UILabel>(); gameOverGui.enabled = false; // audioSourceMngr.PlaySource("AS_StartHunger" ,false); timeBetweenFill = Random.Range(15, 30); }
public void AssignCrosshair(Crosshair c) { activeCrosshair = c; }
void Start() { _camera = GetComponent<Camera>(); _crosshair = GetComponent<Crosshair>(); _normalFOV = _camera.fieldOfView; }
void Awake() { S = this; }