예제 #1
0
    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);
    }
예제 #2
0
    public PhysicsAction physics; // 物理动作

    // 管理飞行
    public void Fly(GameObject disk, float angle, float power)
    {
        physics = PhysicsAction.GetAction(disk.GetComponent <DiskData>().direction, angle, power);
        this.RunAction(disk, physics, this);
    }