Beispiel #1
0
    public void ExitCombat()
    {
        PlayerActivation playerActivation = this.GetComponent <PlayerActivation>();

        playerActivation.Hide();
        playerActivation.SetBehavioursEnabled(false);
    }
Beispiel #2
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();
        }
    }
Beispiel #3
0
        private async Task <string> CreateActivation(string playerId)
        {
            var activation = new PlayerActivation {
                Id = CodeGenerator.GetCode(), PlayerId = playerId
            };
            await activationRepository.CreateAsync(activation);

            return(activation.Id);
        }
Beispiel #4
0
    /*
     * TODO for version 3
     *
     * add database feature.
     */

    public void Start()
    {
        ShipPrefab = Instantiate(ShipPrefab) as GameObject;
        DontDestroyOnLoad(ShipPrefab);
        PlayerActivation activater = ShipPrefab.GetComponent <PlayerActivation>();

        activater.Hide();
        activater.SetBehavioursEnabled(false);
        activater.SetFactoriesEnabled(true);
    }
Beispiel #5
0
 public void Update()
 {
     if (needsBuild)
     {
         PlayerActivation activater = ShipPrefab.GetComponent <PlayerActivation>();
         needsBuild = false;
         AddBasicBuild();
         activater.Recreate();
         activater.SetBehavioursEnabled(false);
         activater.SetFactoriesEnabled(false);
         activater.Hide();
     }
 }
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);

        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Beispiel #7
0
    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.");
    }
Beispiel #8
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();
    }
Beispiel #9
0
    public void OnGUI()
    {
        GUI.Box(new Rect(Screen.width * 0.5f, Screen.height * 0.5f, 400, 200), "");
        GUI.Label(new Rect(Screen.width * 0.5f + 10, Screen.height * 0.5f + 10, 380, 180), message);

        // Update the toolbar.
        selectedUI = GUI.Toolbar(new Rect(boxSpacing, boxSpacing, customiseRect.width, boxSpacing * 2), selectedUI, toolbarStrings);
        GUI.Box(customiseRect, "");
        int i = 0;

        if (selectedUI == 0)
        {
            foreach (GameObject prefab in weaponFactory.Prefabs)
            {
                Texture buttonGrahpic = (IsMade(weaponFactory, prefab) ? weaponFactory.OnImages[i] : weaponFactory.OffImages[i]);
                if (GUI.Button(weaponButtons[i++], buttonGrahpic))
                {
                    ToggleWeapon(prefab);
                }
            }
        }
        else if (selectedUI == 1)
        {
            foreach (GameObject prefab in skillFactory.Prefabs)
            {
                Texture buttonGrahpic = (IsMade(skillFactory, prefab) ? skillFactory.OnImages[i] : skillFactory.OffImages[i]);
                if (GUI.Button(skillButtons[i++], buttonGrahpic))
                {
                    ToggleSkill(prefab);
                }
            }
        }
        else if (selectedUI == 2)
        {
            foreach (GameObject prefab in controlFactory.Prefabs)
            {
                Texture buttonGrahpic = (IsMade(controlFactory, prefab) ? controlFactory.OnImages[i] : skillFactory.OffImages[i]);
                if (GUI.Button(controlsButtons[i++], buttonGrahpic))
                {
                    ToggleControls(prefab);
                }
            }
        }

        Rect backButtonRect = new Rect(boxSpacing, customiseRect.height - boxSpacing, customiseRect.width, boxSpacing * 2);

        if (GUI.Button(backButtonRect, "Back"))
        {
            if (weaponFactory.Modules.Count <= 0 || skillFactory.Modules.Count <= 0 || controlFactory.Modules.Count <= 0)
            {
                message = "You must always have atleast one weapon, one skill,\nand control scheme on your ship. Please choose these\nbefore leaving this menu.";
                return;
            }

            GameObject       shipPrefab = GameObject.FindGameObjectWithTag("ShipBlueprint");
            PlayerActivation activater  = shipPrefab.GetComponent <PlayerActivation>();
            activater.Hide();
            activater.SetFactoriesEnabled(false);
            Application.LoadLevel("Star Map");
        }
    }