Exemplo n.º 1
0
    public GameObject CreatePlayer(int playerNumber, Transform spawnPoint, Transform parent, TeamColor color, RagdollSize size)
    {
        Prefabber prefabber = null;

        switch (size)
        {
        case RagdollSize.Small:
            prefabber = smallPrefabber;
            break;

        case RagdollSize.Medium:
            prefabber = mediumPrefabber;
            break;

        case RagdollSize.Large:
            prefabber = largePrefabber;
            break;
        }

        if (prefabber == null)
        {
            return(null);
        }
        prefabber.prefab.transform.GetChild(0).GetComponent <Player>().size         = size;
        prefabber.prefab.transform.GetChild(0).GetComponent <Player>().color        = color;
        prefabber.prefab.transform.GetChild(0).GetComponent <Player>().playerNumber = playerNumber;
        GameObject player = Instantiate(prefabber.prefab);

        player.name = string.Format("Player #{0}", playerNumber);
        player.transform.position = spawnPoint.position;
        player.transform.rotation = spawnPoint.rotation;
        player.transform.parent   = parent;
        return(player);
    }
Exemplo n.º 2
0
    void InitBall()
    {
        GameObject prefab = Prefabber.GetPrefab("Ball");

        _ball = Instantiate <GameObject>(
            prefab, Vector3.forward * -5, prefab.transform.rotation
            ).GetComponent <Ball>();
    }
Exemplo n.º 3
0
    void MakeGoal()
    {
        GoalHolder holder = MakeGoalHolder();

        _holders.Add(holder.name, holder);

        Vector3    goalPosition = GetGoalPosition(holder.gameObject);
        GameObject goalPrefab   = Prefabber.GetPrefab("Goal");
        Goal       goal         = Instantiate(
            goalPrefab, holder.transform
            ).AddComponent <Goal>();

        goal.name = "Goal " + _goalsMadeCount;
        goal.transform.position = goalPosition;

        _goalsMadeCount++;
    }