Ejemplo n.º 1
0
    Vector3 direction;      //飞行方向

    //生产函数(工厂模式)
    public static PhysisFlyAction GetSSAction(Vector3 direction, float speed)
    {
        PhysisFlyAction action = ScriptableObject.CreateInstance <PhysisFlyAction>();

        action.speed     = speed;
        action.direction = direction;
        return(action);
    }
Ejemplo n.º 2
0
    public static PhysisFlyAction GetSSAction(GameObject UFO)
    {
        PhysisFlyAction action = ScriptableObject.CreateInstance <PhysisFlyAction>();

        action.speed        = UFO.GetComponent <UFOData>().speed;
        action.gravity      = UFO.GetComponent <UFOData>().gravity;
        action.impluseForce = UFO.GetComponent <UFOData>().impulseForce;
        return(action);
    }
Ejemplo n.º 3
0
    public void SendUFO(GameObject UFO)
    {
        PhysisFlyAction flyAction = PhysisFlyAction.GetSSAction(UFO);
        CSequenceAtion  actions   = CSequenceAtion.GetSSAcition(1, 0, new List <SSAction> {
            flyAction
        });

        this.RunAction(UFO, actions, this);
    }
    public static PhysisFlyAction GetSSAction(Vector3 direction, float angle, float power)
    {
        PhysisFlyAction action = CreateInstance <PhysisFlyAction>();

        if (direction.x == -1)
        {
            action.startVector = Quaternion.Euler(new Vector3(0, 1, -angle)) * Vector3.left * power;
        }
        else
        {
            action.startVector = Quaternion.Euler(new Vector3(0, 1, angle)) * Vector3.right * power;
        }
        action.power = power;
        return(action);
    }
Ejemplo n.º 5
0
    public static PhysisFlyAction GetSSAction(int pos, float force_)
    {
        PhysisFlyAction action = CreateInstance <PhysisFlyAction>();

        if (pos == 1)
        {
            action.start_position = true;
        }
        else
        {
            action.start_position = false;
        }
        action.force = force_;

        return(action);
    }
Ejemplo n.º 6
0
    public void DiskFly(GameObject disk, int mode, mes information)
    {
        int leftOrRight = 1;//from left is 1, from right is -1

        if (disk.transform.position.x > 0)
        {
            leftOrRight = -1;
        }

        if (mode == 2)
        {
            fly = DiskFlyAction.GetSSAction(leftOrRight, information.angle, information.speed);
            this.StartAction(disk, fly);
        }
        else
        {
            fly_ = PhysisFlyAction.GetSSAction(leftOrRight, information.speed);
            this.StartAction(disk, fly_);
        }
    }
Ejemplo n.º 7
0
 //飞碟飞行
 public void playDisk(GameObject disk, float angle, float power)
 {
     fly = PhysisFlyAction.GetSSAction(disk.GetComponent <DiskData>().direction, angle, power);
     this.RunAction(disk, fly, this);
 }
Ejemplo n.º 8
0
 public void Fly(GameObject disk, float speed, Vector3 direction)
 {
     flyAction = PhysisFlyAction.GetSSAction(direction, speed);
     RunAction(disk, flyAction, this);
 }