void Move(int type) { Rigidbody2D enemy = OwnerAI.gameObject.GetComponent <Rigidbody2D>(); //0 break if (type == 0) { enemy.velocity = Vector2.zero; } if (type == 1) { enemy.velocity = SlowMovespeed * TopScript.getPlayerAngleV3(OwnerAI.gameObject.transform.position).normalized; } }
public void FixedUpdate() { for (int i = 0; i < this.runtimeList.Count; i++) { AIAction temp = (AIAction)this.runtimeList[i]; if (temp.action.functionType == Actions.ActionType.attack) { t[i] += Time.fixedDeltaTime; if (temp.trigger == TriggerType.distanceIn) { if (TopScript.GetPlayerDistance(gameObject) <= DistanceBorder) { if (t[i] >= temp.action.AttackInterval) { t[i] = 0; temp.action.run(); } } } if (temp.trigger == TriggerType.always) { if (t[i] >= temp.action.AttackInterval) { t[i] = 0; temp.action.run(); } } } if (temp.trigger == TriggerType.distanceOver) { if (TopScript.GetPlayerDistance(gameObject) > DistanceBorder) { temp.action.run(); } } } }