IEnumerator ChangeState(ChangeStateData data) { for (int i = 0; i < 20; i++) { if (_rd != null) { _rd.material.color = Color.Lerp(_rd.material.color, data.p1, 0.2f); } yield return(new WaitForSeconds(0.05f)); // should wait in any case } if (_col != null) { _col.enabled = data.state; } _rd.material = data.mat; _rd.material.color = Color.black; for (int i = 0; i < 20; i++) { if (_rd != null) { _rd.material.color = Color.Lerp(_rd.material.color, data.p2, 0.2f); Debug.Log(_rd.material.color); } yield return(new WaitForSeconds(1f)); } if (_rd) { _rd.material.color = data.p2; } }
private void CreateChangeState(ChangeStateData changeState) { // create condition variable Add(new Variable("Skill.Framework.AI.ChangeState", changeState.Name, "null")); // new condition variable inside CreateTree method _CreateTreeMethodBody.AppendLine(string.Format("this.{0} = new Skill.Framework.AI.ChangeState(\"{1}\",\"{2}\");", Variable.GetName(changeState.Name), changeState.Name, changeState.DestinationState)); // set weight SetBehaviorParameters(changeState); }