public override void FixedUpdate() { base.FixedUpdate(); if (Mathf.Abs(m_OpponentController.collider.bounds.center.x - m_EnemyController.collider.bounds.center.x) > 1.4f) { int direction; if (m_OpponentController.transform.position.x > m_EnemyController.transform.position.x) { direction = 1; } else { direction = -1; } if (direction == 1) { if (m_Velocity + m_Character.m_Acceleration < m_Character.m_MaxSpeed / 2) { m_Velocity += m_Character.m_Acceleration; } else { m_Velocity = m_Character.m_MaxSpeed / 2; } } else if (direction == -1) { if (Math.Abs(m_Velocity - m_Character.m_Acceleration) < m_Character.m_MaxSpeed / 2) { m_Velocity -= m_Character.m_Acceleration; } else { m_Velocity = (-1) * m_Character.m_MaxSpeed / 2; } } else { if (m_Velocity - m_Character.m_Deceleration > 0.0f) { m_Velocity -= m_Character.m_Deceleration; } else if (m_Velocity + m_Character.m_Deceleration < 0.0f) { m_Velocity += m_Character.m_Deceleration; } else { m_Velocity = 0.0f; } } } else { m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > m_Character.GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).length) m_NextState = new AIBattleIdle(m_Character); }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > 1.0f) m_NextState = new AIBattleIdle(m_Character); }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > 1.0f) { m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer >= 1.0f) { m_NextState = new AIBattleIdle(m_Character); } m_Character.m_TotalForce.x = 0.0f; }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > m_Character.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).length) { m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > m_Character.GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).length + m_Character.m_AttackCooldown) { m_EnemyController.updatePreviousActions(this.ToString()); m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > m_Character.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).length + m_Character.m_AttackCooldown) { m_EnemyController.updatePreviousActions(this.ToString()); m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > 0.6f) { //m_Character.GetComponent<Animator>().SetBool("CounterAttackDown", false); m_Character.m_Opponent.GetHit(10); m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > 3.0f) { m_EnemyController.updatePreviousActions(this.ToString()); m_Character.GetComponent<Animator>().SetBool("BlockDown", false); m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); RaycastHit GroundHitInfo; Ray ray = new Ray(m_Character.m_Center, -m_Character.transform.up); Physics.Raycast(ray, out GroundHitInfo, m_Character.m_Height, 1 << LayerMask.NameToLayer("Terrain")); m_Character.transform.position = new Vector3(m_Character.transform.position.x, GroundHitInfo.point.y + m_Character.m_Height / 2, m_Character.transform.position.z); if (Math.Abs(m_Character.m_TotalForce.x) <= 0.1f) { m_NextState = new AIBattleIdle(m_Character); } }
public override void Update() { base.Update(); timer += Time.deltaTime; if (timer > 3.0f) { m_EnemyController.updatePreviousActions(this.ToString()); m_Character.GetComponent <Animator>().SetBool("BlockDown", false); m_NextState = new AIBattleIdle(m_Character); } }
void Awake() { foreach (string s in Input.GetJoystickNames()) { Debug.Log(s); } _MaxHealth = 1000; _Damage = 10; MaxSpeed = 0.06f; Acceleration = 0.015f; Deceleration = 0.03f; m_CurrentState = new AIBattleIdle(this); m_ComboState = new NoInputState(this, new NoInputState(this, null)); m_FacingRight = true; m_TotalForce = Vector3.zero; m_NGramWindowSize = 2; m_MaxHealth = 100.0f; m_CurrentHealth = 100.0f; nGramPredictor = new HierarchicalNGramPredictor(m_NGramWindowSize + 1); nGramPredictor.threshold = 1; //nGramPredictor = new NGramPredictor(); //nGramPredictor.nValue = m_NGramWindowSize + 1; //nGramPredictor.Init(); previousActions = new string[m_NGramWindowSize + 1]; predictionSequence = new string[m_NGramWindowSize]; //attackSequence = new string[5]; if (Root.Instance != null) { m_GravityForce = Root.Instance.gravity; } else { m_GravityForce = -0.01f; } m_MaxFallSpeed = -0.1f; }
void Awake() { foreach (string s in Input.GetJoystickNames()) { Debug.Log(s); } _MaxHealth = 1000; _Damage = 10; MaxSpeed = 0.06f; Acceleration = 0.015f; Deceleration = 0.03f; m_CurrentState = new AIBattleIdle(this); m_ComboState = new NoInputState(this, new NoInputState(this, null)); m_FacingRight = true; m_TotalForce = Vector3.zero; m_NGramWindowSize = 2; m_MaxHealth = 100.0f; m_CurrentHealth = 100.0f; nGramPredictor = new HierarchicalNGramPredictor(m_NGramWindowSize +1); nGramPredictor.threshold = 1; //nGramPredictor = new NGramPredictor(); //nGramPredictor.nValue = m_NGramWindowSize + 1; //nGramPredictor.Init(); previousActions = new string[m_NGramWindowSize + 1]; predictionSequence = new string[m_NGramWindowSize]; //attackSequence = new string[5]; if (Root.Instance != null) { m_GravityForce = Root.Instance.gravity; } else { m_GravityForce = -0.01f; } m_MaxFallSpeed = -0.1f; }
public override void FixedUpdate() { base.FixedUpdate(); if (timer < 1f) { int direction; if (m_PlayerController.transform.position.x > m_EnemyController.transform.position.x) direction = -1; else direction = 1; if (direction == 1) { if (m_Velocity + m_Character.m_Acceleration < m_Character.m_MaxSpeed / 2) { m_Velocity += m_Character.m_Acceleration; } else { m_Velocity = m_Character.m_MaxSpeed / 2; } } else if (direction == -1) { if (Math.Abs(m_Velocity - m_Character.m_Acceleration) < m_Character.m_MaxSpeed / 2) { m_Velocity -= m_Character.m_Acceleration; } else { m_Velocity = (-1) * m_Character.m_MaxSpeed / 2; } } else { if (m_Velocity - m_Character.m_Deceleration > 0.0f) { m_Velocity -= m_Character.m_Deceleration; } else if (m_Velocity + m_Character.m_Deceleration < 0.0f) { m_Velocity += m_Character.m_Deceleration; } else { m_Velocity = 0.0f; } } waitTimer = 0.0f; } else m_Velocity = 0.0f; if (waitTimer > 1f) m_NextState = new AIBattleIdle(m_Character); }
public override void FixedUpdate() { base.FixedUpdate(); if (timer < 1f) { int direction; if (m_PlayerController.transform.position.x > m_EnemyController.transform.position.x) { direction = -1; } else { direction = 1; } if (direction == 1) { if (m_Velocity + m_Character.m_Acceleration < m_Character.m_MaxSpeed / 2) { m_Velocity += m_Character.m_Acceleration; } else { m_Velocity = m_Character.m_MaxSpeed / 2; } } else if (direction == -1) { if (Math.Abs(m_Velocity - m_Character.m_Acceleration) < m_Character.m_MaxSpeed / 2) { m_Velocity -= m_Character.m_Acceleration; } else { m_Velocity = (-1) * m_Character.m_MaxSpeed / 2; } } else { if (m_Velocity - m_Character.m_Deceleration > 0.0f) { m_Velocity -= m_Character.m_Deceleration; } else if (m_Velocity + m_Character.m_Deceleration < 0.0f) { m_Velocity += m_Character.m_Deceleration; } else { m_Velocity = 0.0f; } } waitTimer = 0.0f; } else { m_Velocity = 0.0f; } if (waitTimer > 1f) { m_NextState = new AIBattleIdle(m_Character); } }
public void Land() { m_NextState = new AIBattleIdle(m_Character); }
public override void FixedUpdate() { base.FixedUpdate(); if (Mathf.Abs(m_OpponentController.collider.bounds.center.x - m_EnemyController.collider.bounds.center.x) > 1.4f) { int direction; if (m_OpponentController.transform.position.x > m_EnemyController.transform.position.x) direction = 1; else direction = -1; if (direction == 1) { if (m_Velocity + m_Character.m_Acceleration < m_Character.m_MaxSpeed / 2) { m_Velocity += m_Character.m_Acceleration; } else { m_Velocity = m_Character.m_MaxSpeed / 2; } } else if (direction == -1) { if (Math.Abs(m_Velocity - m_Character.m_Acceleration) < m_Character.m_MaxSpeed / 2) { m_Velocity -= m_Character.m_Acceleration; } else { m_Velocity = (-1) * m_Character.m_MaxSpeed / 2; } } else { if (m_Velocity - m_Character.m_Deceleration > 0.0f) { m_Velocity -= m_Character.m_Deceleration; } else if (m_Velocity + m_Character.m_Deceleration < 0.0f) { m_Velocity += m_Character.m_Deceleration; } else { m_Velocity = 0.0f; } } } else m_NextState = new AIBattleIdle(m_Character); }