public void BuyUpgrade(int id) { if (StaticManager.GetPlayer().SpendScore(_views[id].Model.Price)) { var view = _views[id]; view.Model.Level++; view.Model.Price *= 1.5; view.Init(view.Model); UpdateViews(); } }
void Awake() { if (status == null) { DontDestroyOnLoad(gameObject); status = this; } else if (status != null) { Destroy(gameObject); } }
protected virtual void Shoot() { if (_numberOfShoots < 1) { Instantiate(soundEffect); GetComponentInParent <Character>().MovementState.ChangeState(CharacterStates.MovementStates.Attacking); StartCoroutine("endAnimation"); Vector3 target = new Vector3(_brain.Target.position.x + UnityEngine.Random.Range(-1f, 1f), _brain.Target.position.y + UnityEngine.Random.Range(-1f, 1f), _brain.Target.position.z); Instantiate(aoeProjectile, target, Quaternion.identity, StaticManager.ObjectPool.transform); StaticManager.addObjectToPool(); _numberOfShoots++; } }
} // InWorld allows us to tell when our character object has been loaded in the world. // ============================================================================================================ // Ctor, Initialization, Dispose, Update // ============================================================================================================ public WorldModel() { Service.Add <WorldModel>(this); _engine = Service.Get <UltimaGame>(); _network = Service.Get <INetworkClient>(); _userInterface = Service.Get <UserInterfaceService>(); Entities = new EntityManager(this); Entities.Reset(true); Effects = new EffectManager(this); Statics = new StaticManager(); Input = new WorldInput(this); Interaction = new WorldInteraction(this); Client = new WorldClient(this); }
private void Awake() { if (Instance == null) { //Default players id for saving records p1 = new User("Player1", 9); p2 = new User("Player2", 11); Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
/// <summary> /// Render frame<para/> /// Отрисовка одного кадра /// </summary> /// <param name="delta">Tween</param> public static void Render(float delta) { // Render city if it's loaded // Подготовка города если он загружен if (CityManager.State == CityManager.CityState.Complete) { StaticManager.Render(delta); } // Update debug stuff // Обновление дебага Dev.DebugStuff.Render(); // Rendering single frame // Отрисовка одного кадра Renderer.RenderFrame(); }
// ================================================================================ // Ctor, Initialization, Dispose, Update // ================================================================================ public WorldModel() : base() { ServiceRegistry.Register <WorldModel>(this); m_Engine = ServiceRegistry.GetService <UltimaGame>(); m_Network = ServiceRegistry.GetService <INetworkClient>(); m_UserInterface = ServiceRegistry.GetService <UserInterfaceService>(); Entities = new EntityManager(this); Entities.Reset(true); Effects = new EffectManager(this); Statics = new StaticManager(); Input = new WorldInput(this); Interaction = new WorldInteraction(this); Client = new WorldClient(this); }
// Use this for initialization void Start() { GameMan = GameObject.Find("GameManager"); GM = GameMan.transform.GetComponent <GameManager> (); StaticManager.stageClear [GM.level - 1, GM.stage - 1] = true; StaticManager.saveData(); time = Mathf.FloorToInt(GM.milTime); getCranes = GM.getCranes; cranes = GM.cranes; score = string.Format("TIME {0}min{1}sec\nCRANE {2} / {3}", time / 60, time % 60, getCranes, cranes); Text text = transform.GetComponent <Text>(); try{ text.text = score; }catch { } }
// Use this for initialization void Start() { if (GameObject.Find("StaticManager") != null) { staticManager = GameObject.Find("StaticManager").GetComponent <StaticManager>(); } start.onClick.AddListener(ContinueButton); exit.onClick.AddListener(ExitButton); menu.onClick.AddListener(MenuButton); ReloadItem.onClick.AddListener(ReloadBuy); debugToggle.onValueChanged.AddListener(DebugToggled); keys.text = "Button Layout \nMove: W A S D\nSprint: Left Shift\nJump: Space\nReload: R\nShoot: Left Mouse Button\nChange Weapons: Scroll Wheel\nPistol: 1\nSmg(When found): 2"; debugIsToggledOn = false; zombiezInScene.enabled = false; fps.enabled = false; hardness.enabled = false; }
public virtual IEnumerator waitBeforeShooting(float x) { yield return(new WaitForSecondsRealtime(x)); //play animation GetComponentInParent <Character>().MovementState.ChangeState(CharacterStates.MovementStates.Attacking); StartCoroutine("endAnimation"); explosions = 0; currentLocation = transform.position; float mult = (10 / (_brain.Target.position - currentLocation).magnitude); targetLocation = currentLocation + (_brain.Target.position - currentLocation) * mult; distanceBetweenExplosions = (targetLocation - transform.position) / totalExplosions; StartCoroutine("chainExplosion"); StaticManager.addObjectToPool(); }
public void setNewValue() { switch (type) { case sliderType.Master: SaveLoad.current.masterVolume = slider.value; break; case sliderType.Music: SaveLoad.current.musicVolume = slider.value; break; case sliderType.SFX: SaveLoad.current.sfxVolume = slider.value; break; default: Debug.Log("Invalid SliderType Case"); break; } StaticManager.matchVolumeSettings(); }
public void UpdateViews() { bool unknown = false; double score = StaticManager.GetPlayer().GetScore(); print(_views); foreach (UpgradeElementView view in _views) { if (unknown) { view.SetUnknown(); } else { view.SetEnabled(score >= view.Model.Price); } if (view.Model.Level == 0) { unknown = true; } } }
void Start() { Instance = this; }
// Apply static object positions and display some data public void ApplyStaticObjPos() { for (int i = 0; i < rv.staticsParent.childCount; i++) { float prevLen = rv.staticsParent.GetChild(i).localScale.z; float newLen = 1; float prevZSize = 0; float newZSize = 0; if (vel > 0) { newLen = Formulas.GetMoversLength(1, vel); } else if (vel < 0) { newLen = Formulas.GetStaticsLength(1, vel); } // Change object position rv.staticsParent.GetChild(i).position -= new Vector3(0, 0, vel * timeTicks * Formulas.GetGamma(vel)); // Apply the changed scale prevZSize = rv.staticsParent.GetChild(i).GetComponent <Collider>().bounds.size.z; rv.staticsParent.GetChild(i).localScale = new Vector3(1, 1, newLen); newZSize = rv.staticsParent.GetChild(i).GetComponent <Collider>().bounds.size.z; // Position change due to scale (do proper scale) float posChange = Mathf.Abs(newZSize - prevZSize) / 2; if (accelerating == 1) { rv.staticsParent.GetChild(i).position -= new Vector3(0, 0, posChange); } else if (accelerating == -1) { rv.staticsParent.GetChild(i).position += new Vector3(0, 0, posChange); } // Change in object distance Vector3 statInitPos = rv.staticsParent.GetChild(i).GetComponent <StaticManager>().initPos; float objDist = statInitPos.z - transform.position.z; if (vel > 0) { float objDistDiff = objDist * Formulas.GetGamma(vel) - objDist; rv.staticsParent.GetChild(i).position = statInitPos + new Vector3(0, 0, objDistDiff); } else if (vel < 0) { float objDistDiff = objDist - objDist / Formulas.GetGamma(vel); rv.staticsParent.GetChild(i).position = statInitPos - new Vector3(0, 0, objDistDiff); } /* * // Apply the clock tick rate - thetta0 * if (rv.staticsParent.GetChild(i).name.Contains("Windmill")) * { * float defSpeed = rv.staticsParent.GetChild(i).GetComponent<StaticManager>().defRotSpeed; * * if (vel > 0) * { * rv.staticsParent.GetChild(i).GetComponent<StaticManager>().rotSpeed = defSpeed * Formulas.GetGamma(vel); * } * else if (vel < 0) * { * rv.staticsParent.GetChild(i).GetComponent<StaticManager>().rotSpeed = defSpeed / Formulas.GetGamma(vel); * } * } */ // Apply time to the windmill propellers (it takes time for the light to get to the observer's eye if (rv.staticsParent.GetChild(i).name.Contains("Windmill")) { float distDiff = rv.staticsParent.GetChild(i).position.z - transform.position.z; rv.staticsParent.GetChild(i).GetComponent <StaticManager>().SetVisibleRotation( -Formulas.GetGamma(vel) * ((vel * distDiff) / Mathf.Pow(Formulas.lightSpeed, 2))); /* * if (vel > 0) * { * rv.staticsParent.GetChild(i).GetComponent<StaticManager>().SetVisibleRotation( * Formulas.GetGamma(vel) * (time + (vel * distDiff) / Mathf.Pow(Formulas.lightSpeed, 2))); * } * else if (vel < 0) * { * rv.staticsParent.GetChild(i).GetComponent<StaticManager>().SetVisibleRotation( * Formulas.GetGamma(vel) * (time - (vel * distDiff) / Mathf.Pow(Formulas.lightSpeed, 2))); * } * else * { * rv.staticsParent.GetChild(i).GetComponent<StaticManager>().SetVisibleRotation( * distDiff / Formulas.lightSpeed); * } */ } // Apply moving static object's position StaticManager sm = rv.staticsParent.GetChild(i).GetComponent <StaticManager>(); if (sm.isMover == true) { if (vel > 0) { float ticks = timeTicks / Formulas.GetGamma(vel); sm.travelDist += 2 * vel * timeTicks; rv.staticsParent.GetChild(i).localPosition += new Vector3(0, 0, sm.travelDist * Formulas.GetGamma(vel)); } else if (vel < 0) { float ticks = timeTicks * Formulas.GetGamma(vel); sm.travelDist += 2 * vel * timeTicks; rv.staticsParent.GetChild(i).localPosition += new Vector3(0, 0, sm.travelDist / Formulas.GetGamma(vel)); } else { //sm.travelDist += vel * timeTicks; //rv.staticsParent.GetChild(i).localPosition += new Vector3(0, 0, // 0.5f * Formulas.lightSpeed * 0.02f); } } } // Update static object shared time (tick rate based timescale) staticManager.UpdateTime(timeTicks); }
private void OnEnable() { events = StaticManager.GetStaticEvent(); }
// Use this for initialization void Start() { myInstance = this; }
private void onInteractButton(InputEventMouse e, AEntity overEntity, Vector2 overEntityPoint) { if (e.EventType == MouseEvent.Down) { // prepare to pick this item up. m_DraggingEntity = overEntity; m_dragOffset = overEntityPoint; } else if (e.EventType == MouseEvent.Click) { if (overEntity is Ground) { // no action. } else if (overEntity is StaticItem) { // pop up name of item. overEntity.AddOverhead(MessageType.Label, "<outline>" + overEntity.Name, 0, 0); StaticManager.AddStaticThatNeedsUpdating(overEntity as StaticItem); } else if (overEntity is Item) { // request context menu World.Interaction.SingleClick(overEntity); } else if (overEntity is Mobile) { // request context menu World.Interaction.SingleClick(overEntity); } } else if (e.EventType == MouseEvent.DoubleClick) { if (overEntity is Ground) { // no action. } else if (overEntity is StaticItem) { // no action. } else if (overEntity is Item) { // request context menu World.Interaction.DoubleClick(overEntity); } else if (overEntity is Mobile) { // Send double click packet. // Set LastTarget == targeted Mobile. // If in WarMode, set Attacking == true. World.Interaction.DoubleClick(overEntity); World.Interaction.LastTarget = overEntity.Serial; if (EntityManager.GetPlayerObject().Flags.IsWarMode) { m_Network.Send(new AttackRequestPacket(overEntity.Serial)); } } } else if (e.EventType == MouseEvent.DragBegin) { if (overEntity is Ground) { // no action. } else if (overEntity is StaticItem) { // no action. } else if (overEntity is Item) { // attempt to pick up item. World.Interaction.PickupItem((Item)overEntity, new Point((int)m_dragOffset.X, (int)m_dragOffset.Y)); } else if (overEntity is Mobile) { // drag off a status gump for this mobile. } } e.Handled = true; }
void Awake() { Debug.Log("Starting game manager..."); StaticManager.InitializeGameManager(port, server, gameName); }
private void Close(object obj) { StaticManager.CloseApp(); }
public void Init(StaticManager manager) { m_manager = manager; }