예제 #1
0
    private void makeTeam(Team team, bool makePlayer)
    {
        CombatTeam combatTeam = new CombatTeam();

        TeamTarget allies  = TeamTarget.TargetJust(combatTeam);
        TeamTarget enemies = TeamTarget.TargetAllExcept(combatTeam);

        for (int i = 0; i < team.ShipCount; i++)
        {
            makeShip(team.Prefab, combatTeam, allies, enemies, new Vector3(team.Pos.x + Random.Range(-Dist, Dist), 0, team.Pos.z + Random.Range(-Dist, Dist)));
        }

        if (makePlayer)
        {
            // Make cursor
            MonoBehaviour.Instantiate(cursor, new Vector3(0, 0, 0), Quaternion.identity);

            // Reset player for start of combat.
            GameObject player = GameObject.FindGameObjectWithTag("ShipBlueprint");
            player.transform.position = new Vector3(team.Pos.x + +Random.Range(-Dist, Dist), 0, team.Pos.z + Random.Range(-Dist, Dist));
            player.transform.rotation = new Quaternion(0, 0, 0, 0);
            player.GetComponent <TeamMarker>().Team            = combatTeam;
            player.GetComponent <TargetMarker>().AlliedTargets = allies;
            player.GetComponent <TargetMarker>().EnemyTargets  = enemies;

            PlayerActivation activater = player.GetComponent <PlayerActivation>();
            activater.Recreate();
            activater.SetBehavioursEnabled(true);
            activater.Show();
        }
    }
예제 #2
0
파일: LoginGUI.cs 프로젝트: kyranitar/gaf
    void GSInsertUsername()
    {
        // TODO show splash screen.
        stringToEdit = GUI.TextField(LoginFieldPos, stringToEdit, 25);

        if (GUI.Button(ConfirmLoginPos, "Go"))
        {
            PlayerActivation activater = GameObject.FindGameObjectWithTag("ShipBlueprint").GetComponent <PlayerActivation>();
            activater.Show();

            FacebookController.FacebookUsername = stringToEdit;
        }

        GUI.Label(labelPos, "A facebook username should be entered.\nCreate one with Facebook, in your account settings.");
    }
예제 #3
0
    public void Start()
    {
        // Show ship and enable factories
        GameObject shipPrefab = GameObject.FindGameObjectWithTag("ShipBlueprint");

        PlayerActivation activater = shipPrefab.GetComponent <PlayerActivation>();

        activater.SetFactoriesEnabled(true);
        activater.Show();


        foreach (ModuleFactory mf in shipPrefab.GetComponents <ModuleFactory>())
        {
            if (mf.FactoryType == "Weapon")
            {
                weaponFactory = mf;
            }
            else if (mf.FactoryType == "Skill")
            {
                skillFactory = mf;
            }
            else if (mf.FactoryType == "Control")
            {
                controlFactory = mf;
            }
        }

        // Set Factory-dependent variables
        numWeapons  = weaponFactory.Prefabs.Count;
        numSkills   = skillFactory.Prefabs.Count;
        numControls = controlFactory.Prefabs.Count;

        // TODO update this stuff to version 3.0

        InitUI();
    }