public static PhyUFOFlyAction GetSSAction(Vector3 angle, float speed) { //初始化物体将要运动的初速度向量 PhyUFOFlyAction action = CreateInstance <PhyUFOFlyAction>(); action.angle = angle; action.speed = speed; return(action); }
public static PhyUFOFlyAction GetSSAction(Vector3 direction, float angle, float power) { //初始化物体将要运动的初速度向量 PhyUFOFlyAction action = CreateInstance <PhyUFOFlyAction>(); if (direction.x == -1) { action.start_vector = Quaternion.Euler(new Vector3(0, 0, -angle)) * Vector3.left * power; } else { action.start_vector = Quaternion.Euler(new Vector3(0, 0, angle)) * Vector3.right * power; } action.power = power; return(action); }
public void UFOFly(DiskModel disk) { ruler.setRound(round); disk.disk.transform.position = ruler.getStart();//设置飞碟的出现位置 int index = 0; for (; diskID[index] != -1; index++) { ; //找到空闲的 Action } Vector3 angle = Vector3.left; int flag = Random.Range(0, 2); if (flag == 1) { angle *= -1; } actions[index] = PhyUFOFlyAction.GetSSAction(angle, ruler.getSpeed());//从ruler中获取初速度和飞行角度,加速度为10 diskID[index] = disk.getDiskID(); this.RunAction(disk.disk, actions[index], this); }
//飞碟飞行 public void UFOFly(GameObject disk, float angle, float power) { fly = PhyUFOFlyAction.GetSSAction(disk.GetComponent <DiskData>().direction, angle, power); this.RunAction(disk, fly, this); }