Пример #1
0
    static public string GetPlayerPrefab(ColorPathType path)
    {
        string obj = "";

        switch (path)
        {
        case ColorPathType.Blue:
            obj = "Prefabs/Cylinders/BlueCylinder";
            break;

        case ColorPathType.Green:
            obj = "Prefabs/Cylinders/GreenCylinder";
            break;

        case ColorPathType.Orange:
            obj = "Prefabs/Cylinders/OrangeCylinder";
            break;

        case ColorPathType.Purple:
            obj = "Prefabs/Cylinders/PurpleCylinder";
            break;

        case ColorPathType.Red:
            obj = "Prefabs/Cylinders/RedCylinder";
            break;

        case ColorPathType.Yellow:
            obj = "Prefabs/Cylinders/YellowCylinder";;
            break;
        }
        return(obj);
    }
Пример #2
0
    public GameObject GetColorPathObject(ColorPathType path)
    {
        GameObject obj = bluePath;

        switch (path)
        {
        case ColorPathType.Blue:
            obj = bluePath;
            break;

        case ColorPathType.Green:
            obj = greenPath;
            break;

        case ColorPathType.Orange:
            obj = orangePath;
            break;

        case ColorPathType.Purple:
            obj = purplePath;
            break;

        case ColorPathType.Red:
            obj = redPath;
            break;

        case ColorPathType.Yellow:
            obj = yellowPath;
            break;
        }

        return(obj);
    }
Пример #3
0
    public static List <GameObject> FindTargetBlocks(ColorPathType path, int step)
    {
        GameObject obj = gameBoard.GetColorPathObject(path);

        //Debug.LogWarning("begin: " + obj.name);
        return(gameBoard.FindMoveTargets(obj, step - 1, true));
    }
Пример #4
0
    static public PlayerController InstantiatePlayer(ColorPathType path)
    {
        string obj = GetPlayerPrefab(path);

        GameObject go     = (GameObject)Instantiate(Resources.Load(obj), Vector3.zero, Quaternion.identity);
        var        player = go.GetComponentInChildren <PlayerController>();

        return(player);
    }
Пример #5
0
    static public PlayerController CreateForeignPlayer(ColorPathType colorPath)
    {
        PlayerController player = InstantiatePlayer(colorPath);

        player.Initialize(colorPath, PlayerType.ForeignPlayer);

        playerControllers.Add(player);

        return(player);
    }
Пример #6
0
    static public PlayerController createAvatarPlayer(ColorPathType colorPath, Vector3 position, Quaternion rotation)
    {
        string     prefabName = GetPlayerPrefab(colorPath);
        GameObject obj        = PhotonNetwork.Instantiate(prefabName, position, rotation, 0);

        PlayerController player = obj.GetComponent <PlayerController>();

        player.Initialize(colorPath, PlayerType.LocalPlayer);

        return(player);
    }
Пример #7
0
 public void Initialize(ColorPathType pathType, PlayerType ptype)
 {
     this.colorPath  = pathType;
     this.playerType = ptype;
 }