MovableState CreateNewState(Texture2D stateTexture, Vector3 position, string stateName) { MovableState newMovableState = Instantiate(movableState, new Vector3(position.x, position.y, position.z - 1), Quaternion.identity) as MovableState; newMovableState.transform.SetParent(this.transform); newMovableState.SetState(stateTexture, stateName); Vector2 pos = new Vector2(-6.5f, -4.5f); Vector2 size = new Vector2(8f, 7.5f); Rect r = new Rect(pos, size); newMovableState.setBoundraries(r); currentStates.Add(newMovableState); SelectState(newMovableState); newMovableState.Click.AddListener((State state) => { SelectState(state); }); return(newMovableState); }
//--------------------------------------------------------------------------- /// <summary> /// 1文字ずつ表示する /// </summary> /// <param name="message"></param> /// <param name="duration"></param> /// <returns></returns> public UIView.MovableState Play(string message, float duration = 0.1f, int fadeWidth = 2, Func <bool> onFinished = null) { TextMeshProUGUI textMesh = _textMesh; if (textMesh == null || string.IsNullOrEmpty(message) == true) { return(null); } if (gameObject.activeSelf == false) { gameObject.SetActive(true); } if (gameObject.activeInHierarchy == false) { // 親以上がアクティブになっていないので再生できない Debug.LogWarning("Parent is not active"); return(null); } UIView.MovableState state = new MovableState(); StartCoroutine(Play_Private(message, duration, fadeWidth, onFinished, state)); return(state); }
void OnStateSync(MovableState newState) { _previousState = _serverState; _serverState = newState; if (_previousState.serverFrame > 0) { _interpolationTime = 0.0f; _interpolationDuration = (_serverState.serverFrame - _previousState.serverFrame) * ServerSimulation.serverTimestep; } }
public void TriggerState(State state) { MovableState playerState = (MovableState)state; int playerStateType = (int)playerState.PlayerState; if (state.phase == Phase.Start) { // Debug.Log(playerStateType); _animator.SetInteger(PlayerState, playerStateType); _animator.SetTrigger(ChangeState); } }
public void CreateNewStateConnection(string conn) { MovableState stateToConnect = GetState(conn); if (selectedState != null && stateToConnect != null && stateToConnect != selectedState) { selectedState.connections.Add(stateToConnect.idName); stateToConnect.connections.Add(selectedState.idName); } showConnection(); }
public MovableState GetState(string stateName) { MovableState stateToReturn = null; foreach (MovableState s in currentStates) { if (s.idName == stateName) { stateToReturn = s; break; } } return(stateToReturn); }
public void Trigger(State state) { MovableState playerState = (MovableState)state; if (playerState.PlayerState == PlayerState.Run) { if (playerState.phase == Phase.Start) { _particleSystem.Play(); } } else { _particleSystem.Stop(); } }
public void Tick() { _sinceLastPick += ServerSimulation.serverTimestep; if (_sinceLastPick > 6.0f || _navmeshAgent.remainingDistance < 0.01f) { Vector2 direction = Random.insideUnitCircle * 10.0f; _navmeshAgent.SetDestination(transform.position + new Vector3(direction.x, 0, direction.y)); _sinceLastPick = 0.0f; } _previousState.position = transform.position; _previousState.rotation = transform.rotation; _previousState.serverFrame = ServerSimulation.frameNumber; _serverState = _previousState; }
public void LoadNewMap() { MapData mapToLoad = mapLoader.loadMap(); if (mapToLoad != null) { EraseCurrentMap(); foreach (StateData sd in mapToLoad.actualStates) { MovableState ms = CreateNewState(sd.texture, sd.positionInMap, sd.stateName); ms.continent = sd.continentName; foreach (string conn in sd.connection) { ms.connections.Add(conn); } } } }