Esempio n. 1
0
    void Loaded()
    {
        Debug.Log("Loaded.");

        string[] classNames =
        {
            "rep_inf_ep2_rifleman",
            "rep_inf_ep2_rocketeer",
            "rep_inf_ep2_sniper",
            "rep_inf_ep2_engineer",
            "rep_inf_ep2_jettrooper",
            "rep_inf_ep3_rifleman",
            "rep_inf_ep3_rocketeer",
            "rep_inf_ep3_sniper",
            "rep_inf_ep3_sniper_felucia",
            "rep_inf_ep3_engineer",
            "rep_inf_ep3_officer",
            "rep_inf_ep3_jettrooper",
        };

        PhxRuntimeScene scene = PhxGameRuntime.GetScene();

        PhxClass[] classes = new PhxClass[classNames.Length];

        for (int i = 0; i < classes.Length; ++i)
        {
            classes[i] = scene.GetClass(classNames[i]);
            if (classes[i] == null)
            {
                Debug.LogError($"Cannot find class '{classNames[i]}'!");
                return;
            }
        }

        if (SpawnMobs)
        {
            Instances = new PhxSoldier[Width * Height];
            for (int x = 0; x < Width; ++x)
            {
                for (int y = 0; y < Height; ++y)
                {
                    Vector3 pos = new Vector3(x * -Padding, 0f, y * -Padding);
                    pos.x += Random.Range(-0.2f, 0.2f);
                    pos.z += Random.Range(-0.2f, 0.2f);

                    PhxClass spawnClass = classes[Random.Range(0, classes.Length)];

                    int idx = x + (Width * y);
                    Instances[idx] = MATCH.SpawnAI <PhxAnimTestController>(spawnClass, pos, Quaternion.identity);
                    Instances[idx].Fixate();
                }
            }
        }

        if (SpawnPlayer)
        {
            MATCH.SpawnPlayer(classes[5], transform.position, Quaternion.identity);
        }
    }
 void ClearScene()
 {
     RTScene.Clear();
     RTScene = null;
     Match.Clear();
     Match              = null;
     Timers             = null;
     OnLoadscreenLoaded = null;
     OnExecuteMain      = null;
     OnLoaded           = null;
 }
Esempio n. 3
0
    public static void SetClassProperty(string className, string propName, object propValue)
    {
        PhxRuntimeScene scene = PhxGameRuntime.GetScene();

        scene?.SetClassProperty(className, propName, propValue);
    }