public void TransitionToBounds() { lockToBounds = false; sizeTransition = new TransitionFloat(camera.orthographicSize, 0.5f, TransitionFloat.EASE_OUT); xTransition = new TransitionFloat(transform.position.x, 0.5f, TransitionFloat.EASE_OUT); yTransition = new TransitionFloat(transform.position.y, 0.5f, TransitionFloat.EASE_OUT); GetComponent <Future>().schedule(0.5f, delegate() { lockToBounds = true; }); List <Vector3> points = new List <Vector3>(); if (GameManager.Instance.currentOrb != null) { points.Add(GameManager.Instance.currentOrb.position); } foreach (PlayerController playerController in GameObject.FindObjectsOfType <PlayerController>()) { points.Add(playerController.transform.position); } Rect bounds = getMinCameraBounds(points); sizeTransition.GoTo(Mathf.Max(Mathf.Max( bounds.height / 2 * 1.5f, bounds.width / camera.aspect / 2 * 1.5f), 10)); xTransition.GoTo(bounds.center.x); yTransition.GoTo(bounds.center.y); }
// Use this for initialization void Awake( ) { positionX = new TransitionFloat(transform.localPosition.x); positionY = new TransitionFloat(transform.localPosition.y); positionZ = new TransitionFloat(transform.localPosition.z); rotationX = new TransitionFloat(transform.eulerAngles.x); rotationY = new TransitionFloat(transform.eulerAngles.y); rotationZ = new TransitionFloat(transform.eulerAngles.z); scaleX = new TransitionFloat(transform.localScale.x); scaleY = new TransitionFloat(transform.localScale.y); scaleZ = new TransitionFloat(transform.localScale.z); ConfigPosition(0.5f, TransitionFloat.LINEAR, 1.0f); ConfigRotation(0.5f, TransitionFloat.LINEAR, 1.0f); ConfigScale(0.5f, TransitionFloat.LINEAR, 1.0f); }
void Start() { rb = GetComponent <Rigidbody>(); stateMachine = new StateMachine <StateAgent>(); //patrol State <StateAgent> state = new PatrolState <StateAgent>(this); Transition <StateAgent> transition = new TransitionBool <StateAgent>(this, ref m_isDead, true); state.AddTransition(transition, "Death"); transition = new TransitionFloat <StateAgent>(this, ref m_energy, 0.0f, TransitionFloat <StateAgent> .eCompare.LESS); state.AddTransition(transition, "Recharge"); stateMachine.AddState("Patrol", state); stateMachine.AddState("Attack", new AttackState <StateAgent>(this)); stateMachine.AddState("Death", new DeathState <StateAgent>(this)); stateMachine.AddState("Recharge", new RechargeState <StateAgent>(this)); stateMachine.SetState("Patrol"); }
private void bindRotation(TransitionFloat rotation) { transform.rotation = Quaternion.Euler(0, 0, Mathf.RoundToInt(rotation.CurrentValue) % 360); rotationAngle = new TransitionFloat(Mathf.RoundToInt(rotation.CurrentValue) % 360, rotationDuration, TransitionFloat.EASE_IN_OUT); }
// Use this for initialization void Awake( ) { this.rotationAngle = new TransitionFloat(0, rotationDuration, TransitionFloat.EASE_IN_OUT); }