private IEnumerator ChangePlayerSpeed(SpeedChange speedChange) { float speedDelta = 0.0f; if (speedChange == SpeedChange.DOWN) { playerMovement.abilities.jumpDisabled = true; } while (speedDelta <= 1.0f) { if (speedChange == SpeedChange.DOWN) { playerMovement.groundSettings.speed = Mathf.Lerp(originalSpeed, playerSlowdownSpeed, speedDelta); } else { playerMovement.groundSettings.speed = Mathf.Lerp(playerSlowdownSpeed, originalSpeed, speedDelta); } speedDelta += 0.1f; yield return(new WaitForSeconds(0.1f)); } if (speedChange == SpeedChange.UP) { playerMovement.abilities.jumpDisabled = false; } }
protected ModDaycore() { SpeedChange.BindValueChanged(val => { freqAdjust.Value = SpeedChange.Default; tempoAdjust.Value = val.NewValue / SpeedChange.Default; }, true); }
public void PushSpeedChange(float targetSpeed, float duration) { var change = new SpeedChange { targetSpeed = targetSpeed, duration = duration }; speedChangeStack.Add(change); }
public void Resume() { skilltreeUI.SetActive(false); SpeedChange change = FindObjectOfType <SpeedChange>(); change.Resume(); GameIsPaused = false; blurEffect.SetActive(false); darkenEffect.SetActive(false); }
public void Pause() { SpeedChange change = FindObjectOfType <SpeedChange>(); //FindObjectOfType<CountryDisplay>().HideCountryInfo(); pauseMenuUI.SetActive(true); change.Pause(); GameIsPaused = true; blurEffect.SetActive(true); darkenEffect.SetActive(true); }
void Start() { health = GetComponent(typeof(CharacterHealth)) as CharacterHealth; behaviorTree = GetComponent <BehaviorTree>(); deathmatchAgent = GetComponent <DeathmatchAgent>(); navMeshAgent = GetComponent <NavMeshAgent>(); characterController = GetComponent <RigidbodyCharacterController>(); speedChange = GetComponent <SpeedChange>(); inventory = GetComponent <Opsive.ThirdPersonController.Wrappers.Inventory>(); if (flowchart == null && flowchartName != null && flowchartName.Trim().Length != 0) { flowchart = GameObject.Find("/Fungus/Flowcharts/" + flowchartName).GetComponent <Fungus.Flowchart>(); } trackEvent.AddListener(TrackTargetsInLayers); }
/// <summary> /// Initializes the MovementType. /// </summary> /// <param name="characterLocomotion">The reference to the character locomotion component.</param> public override void Initialize(UltimateCharacterLocomotion characterLocomotion) { base.Initialize(characterLocomotion); m_PlayerInput = characterLocomotion.gameObject.GetCachedComponent <PlayerInput>(); m_LayerManager = characterLocomotion.gameObject.GetCachedComponent <CharacterLayerManager>(); m_PathfindingMovement = characterLocomotion.GetAbility <PathfindingMovement>(); if (m_PathfindingMovement == null) { Debug.LogError("Error: The Point Click Movement Type requires a PathfindingMovement ability."); return; } if (m_CharacterLocomotion.MoveTowardsAbility == null) { Debug.LogError("Error: The Point Click Movement Type requires the MoveTowards ability."); return; } m_SpeedChange = characterLocomotion.GetAbility <SpeedChange>(); m_MinPointClickDistanceSqr = m_MinPointClickDistance * m_MinPointClickDistance; }
public Interruption(SpeedChange speedChange = SpeedChange.None) { this.speedChange = speedChange; }
// Use this for initialization void Awake() { // elapsed is a help var for timing each second elapsed = 0f; // countries.json contains all country information string c = Application.streamingAssetsPath + "/countries.json"; string countries = File.ReadAllText(c); Country[] countryarr = JsonHelper.FromJson <Country>(countries); // the json is parsed into a linked list LinkedList <Logic.Country> countrylist = new LinkedList <Logic.Country>(); LinkedList <RandomEvent> eventslist = ReadInEvents(); float amount = 0, production = 0; // Load game objects InfoPanel panel = FindObjectOfType <InfoPanel>(); Newsticker news = FindObjectOfType <Newsticker>(); infoBox = FindObjectOfType <ActionInfoBox>(); change = FindObjectOfType <SpeedChange>(); // with random we give each country a own influence factor (between 0 and 1) random = new System.Random(); // Get each country from the array, create a new Country object and save it in the linked list foreach (Country country in countryarr) { try { countrylist.AddLast(new Logic.Country(Int32.Parse(country.id), country.code, country.name, Int32.Parse(country.population.Replace(",", "")), country.description, float.Parse(country.waste, CultureInfo.InvariantCulture.NumberFormat), country.rate, random )); // get the starting values for amount and production of plastic amount += float.Parse(country.waste, CultureInfo.InvariantCulture.NumberFormat); production += country.rate; } catch (FormatException err) { UnityEngine.Debug.Log(err.Message.ToString()); } } // create new play object in which most of the game logic is play = new Play(countrylist, eventslist, news); play.SetActions(ReadInActions()); // DateTime objects to map real time to ingame time last = DateTime.Now; print = DateTime.Parse("2019-01-01 00:00:00"); // add starting values to map panel.changeWaste(amount, production); panel.changeCapital(30000000, 2500000); news.AddNews(new News("Start", "Producing this much of plastic waste will exterminate humans til 2070.", NewsType.Emergency)); // initialize game with first play tick play.Tick(print); }
public void Pause() { skilltreeUI.SetActive(true); Image[] l = action.GetComponentsInChildren <Image>(); //Debug.Log("Length: " + l.Length); LinkedList <Action> actions = Game.play.GetActions(); HashSet <int> unique = new HashSet <int>(); foreach (Action a in actions) { if (a.GetState().Equals(ActionClick.State.Developed)) { unique.Add(a.GetId()); } } int[] developed = new int[unique.Count]; unique.CopyTo(developed); foreach (Image im in l) { string[] parts = im.sprite.name.Split('-'); foreach (Action a in actions) { if (parts[0] == a.GetId().ToString()) { if (a.Unlocked(developed)) { //if((a.GetPrice() <= Game.play.GetCapital().GetAmount()) && (a.GetPoints() <= Game.play.GetLobby().GetAmount())) { if (a.GetState().Equals(ActionClick.State.Activated)) { im.sprite = Resources.Load <Sprite>("Actions/" + a.GetId() + "-1"); a.ChangeState(ActionClick.State.Activated); } else if (a.GetState().Equals(ActionClick.State.InDevelopement)) { im.sprite = Resources.Load <Sprite>("Actions/" + a.GetId() + "-3"); } else if ((a.GetState().Equals(ActionClick.State.Developed)) || (a.GetState().Equals(ActionClick.State.Executed))) { im.sprite = Resources.Load <Sprite>("Actions/" + a.GetId() + "-2"); } if ((a.GetState().Equals(ActionClick.State.Activated)) && ((a.GetPrice() > Game.play.GetCapital().GetAmount()) || (a.GetPoints() > Game.play.GetLobby().GetAmount()))) { im.sprite = Resources.Load <Sprite>("Actions/" + a.GetId() + "-0"); } else { } } } } } SpeedChange change = FindObjectOfType <SpeedChange>(); change.Pause(); lobbyText.text = Game.play.GetLobby().PrintStatus(); GameIsPaused = true; blurEffect.SetActive(true); darkenEffect.SetActive(true); Game.play.SetActions(actions); }