public static KinematicsAction GetSSAction(GameObject role_, Vector3 emitPosition_, Vector3 emitDirection_) { Fly(role_, emitPosition_, emitDirection_); KinematicsAction action = ScriptableObject.CreateInstance <KinematicsAction>(); return(action); }
public List <GameObject> GetUFOs(int round, ActionType type) { List <GameObject> ufos = new List <GameObject>(); var count = GetUFOCount(round); for (int i = 0; i < count; ++i) { var index = random.Next(3); var obj = factory.GetUFO(colors[index], type); obj.transform.position = GetRandomPosition(); var ufo = obj.GetComponent <UFO>(); ufo.score = GetScore(round, index); ufo.visible = true; var speed = GetSpeed(round); var direction = GetRandomDirection(type); if (type == ActionType.Kinematics) { KinematicsAction action = KinematicsAction.GetAction(direction, speed); actionManager.AddAction(obj, action); } else { PhysicsAction action = PhysicsAction.GetAction(direction, speed); actionManager.AddAction(obj, action); } ufos.Add(obj); } return(ufos); }
public static KinematicsAction GetAction(Vector3 direction, float speed) { KinematicsAction action = ScriptableObject.CreateInstance <KinematicsAction>(); action.direction = direction; action.speed = speed; action.destroy = false; action.enable = true; return(action); }
// Update is called once per frame public void Fly(GameObject role_, Vector3 emitPosition_, Vector3 emitDirection_) { fly = KinematicsAction.GetSSAction(role_, emitPosition_, emitDirection_); this.RunAction(role_, fly, this); }