예제 #1
0
    // Unity methods
    void Start()
    {
        // Start mouseDirection at (0,0)
        curGesture = new Vector2(0.0f, 0.0f);

        // Start the selection at (0,0)
        curSelection = new Vector2(0.0f, 0.0f);

        // Grab the team object components
        teamBuyList            = FindObjectOfType <PurchaseList>();
        teamTeamSpawnerSpawner = FindObjectOfType <TeamSpawner> ();

        // Find the radial buttons
        GetChildButtons();

        // Hide the cursor when we open
        Cursor.visible = false;

        // Grab the current position of the mouse
        oldMousePos = Input.mousePosition;

        // Slowdown the game speed
        oldTimeScale   = Time.timeScale;
        Time.timeScale = slowdownFactor;
    }
예제 #2
0
 public void init(TeamSpawner sp, Transform[] positions, Transform moveFinalTarget)
 {
     this.moveFinalTarget = moveFinalTarget;
     spawnerModel         = sp;
     spawnPositions       = positions;
     spawnNext();
 }
예제 #3
0
        protected MobSpawn GetSeedChar(BaseMapGenContext map, SpawnList <MobSpawn> specialMobs)
        {
            //the contents of that theme can be selected randomly,
            MobSpawn seedSpawn = null;

            //or, to add some sensibility, make it seeded from a random spawn that can already be found in the map
            if (map.TeamSpawns.CanPick)
            {
                TeamSpawner spawn = map.TeamSpawns.Pick(map.Rand);
                if (spawn != null)
                {
                    List <MobSpawn> exampleList = spawn.ChooseSpawns(map.Rand);
                    if (exampleList.Count > 0)
                    {
                        seedSpawn = exampleList[map.Rand.Next(exampleList.Count)];
                    }
                }
            }
            //choose the spawn, then seed the theme with it
            //the theme will take the aspects of the seedspawn and then be ready to spit out a list
            if (seedSpawn == null && specialMobs.CanPick)
            {
                seedSpawn = specialMobs.Pick(map.Rand);
            }
            return(seedSpawn);
        }
예제 #4
0
 public void init(TeamSpawner sp, Transform[] positions, Transform moveFinalTarget)
 {
     this.moveFinalTarget = moveFinalTarget;
     spawnerModel = sp;
     spawnPositions = positions;
     spawnNext();
 }
    void Awake()
    {
        ph = GetComponent <PhotonView>();

        spawner = GetComponent <TeamSpawner>();
        myAI    = new List <AI_GroundAttack>();
    }
    public CombatFlow spawnPlayer(int teamNum, bool isAI = false)
    {
        CombatFlow newSpawn = null;

        if (!isAI)
        {
            localTeam = CombatFlow.convertNumToTeam((short)teamNum);
            spawnUIPanel.SetActive(false);
        }

        Debug.Log("Spawning player on team: " + teamNum + ", isAI: " + isAI);

        // call almost all of this at runtime after player selects team
        if (playerPrefab == null)
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> playerPrefab Reference. Please set it up in GameObject 'Game Manager'", this);
        }
        else
        {
            Debug.LogFormat("We are Instantiating LocalPlayer from {0}", Application.loadedLevelName);
            // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate

            Debug.Log("LocalPlayerInstance: " + TeamSpawner.localPlayerInstance);

            if (TeamSpawner.localPlayerInstance == null || isAI)
            {
                //PhotonNetwork.Instantiate(this.playerPrefab.name, spawnPoint.position, Quaternion.identity, 0);
                TeamSpawner spawner = getSpawnerByNum(teamNum);
                GameObject  playerObj;

                if (isAI)
                {
                    playerObj = spawner.spawnPlayer(playerPrefab, "Jeff", false);
                    Debug.Log("Spawning AI");
                    spawner.setPlayerAsAI(playerObj);
                    //playerObj.name = "Jeff";
                }
                else
                {
                    playerObj = spawner.spawnPlayer(playerPrefab, PhotonNetwork.NickName);
                    spawner.setPlayerAsControllable(playerObj);
                    localPlayer    = playerObj;
                    playerObj.name = PhotonNetwork.NickName;
                    playerSpawnEvent.Invoke();
                }

                newSpawn = playerObj.GetComponent <CombatFlow>();
                //spawner.setPlayerAsControllable(playerObj);
                //localPlayer = playerObj;
            }
        }

        return(newSpawn);
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        // Grab the Camera for the scene, the first one is the one we want
        mainCam = Camera.main;

        // Grab the TeamSpawner component off of the TeamGameObject
        playersSpawner = playersTeamObject.GetComponent <TeamSpawner>();

        // Grab the PurchaseList off of the TeamGameObject
        playersAvailableUnits = playersTeamObject.GetComponent <PurchaseList>();

        theCanvas = FindObjectOfType <Canvas> ();
    }
    private TeamSpawner getSpawnerByTeam(CombatFlow.Team team)
    {
        TeamSpawner returnObj = null;

        for (int i = 0; i < teamSpawnerCollections.Length; i++)
        {
            TeamSpawner current = teamSpawnerCollections[i].GetComponent <TeamSpawner>();
            if (current.team == team)
            {
                returnObj = current;
            }
        }
        return(returnObj);
    }
예제 #9
0
    public Store()
    {
        carier = new Carier();

        //<<TEST DATA

        WeaponInfo weapon1 = new WeaponInfo();

        weapon1.force      = 3;
        weapon1.radius     = 1f;
        weapon1.reloadTime = 1f;

        WeaponInfo weapon2 = new WeaponInfo();

        weapon2.force      = 2;
        weapon2.radius     = 1f;
        weapon2.reloadTime = 4f;

        UnitInfo unit1 = new UnitInfo();

        unit1.life       = 10;
        unit1.prefabName = "SimpleUnit";
        unit1.id         = 0;
        unit1.armor      = 1;
        unit1.moveSpeed  = 2f;
        unit1.weapon     = weapon1;
        unit1.killCash   = 1;
        unit1.killScore  = 2;
        unit1.viewRadius = 4;

        UnitInfo unit2 = new UnitInfo();

        unit2.life       = 5;
        unit2.prefabName = "FriendlyUnit";
        unit2.id         = 1;
        unit2.armor      = 1;
        unit2.moveSpeed  = 1.1f;
        unit2.weapon     = weapon2;
        unit2.killCash   = 1;
        unit2.killScore  = 2;
        unit2.viewRadius = 4;

        units.Add(unit1);
        units.Add(unit2);

        //SPAWNER
        SpawnerInfo spawner = new SpawnerInfo();

        spawner.waves = new SpawnWave[1];

        SpawnWave wave1 = new SpawnWave();

        wave1.time  = 0f;
        wave1.units = new SpawnUnit[1];

        SpawnUnit spawnUnit = new SpawnUnit();

        spawnUnit.unitId = 0;
        spawnUnit.time   = 1f;
        spawnUnit.count  = 5;

        /*SpawnUnit spawnUnit2 = new SpawnUnit ();
         * spawnUnit2.unitId = 0;
         * spawnUnit2.time = 3;
         * spawnUnit2.count = 1;*/

        wave1.units.SetValue(spawnUnit, 0);
        //wave1.units.SetValue (spawnUnit,1);

        spawner.waves.SetValue(wave1, 0);
        //spawner.waves.SetValue (wave1, 1);

        //LEVELS

        LeveInfo levelInfo = new LeveInfo();

        levelInfo.id    = 1;
        levelInfo.info  = "TestLevel1";
        levelInfo.spawn = spawner;
        levels.Add(levelInfo);

        levelInfo       = new LeveInfo();
        levelInfo.id    = 2;
        levelInfo.info  = "TestLevel2";
        levelInfo.spawn = spawner;
        levels.Add(levelInfo);

        //LEVEL PROGRESS
        LevelProgress level = new LevelProgress();

        level.id = 1;
        carier.levelsProgress.SetValue(level, 1);

        //PLAYER
        playerInfo                  = new PlayerInfo();
        playerInfo.lifes            = 3;
        playerInfo.spawner.spawners = new TeamSpawner[1];
        TeamSpawner teamSpawner = new TeamSpawner();

        teamSpawner.id     = 0;
        teamSpawner.unitId = 1;
        teamSpawner.time   = 0.5f;
        playerInfo.spawner.spawners.SetValue(teamSpawner, 0);


        playerInfo.weaponInfo       = new PlayerWeaponInfo();
        playerInfo.weaponInfo.force = 4;

        carier.playerInfo = playerInfo;

        //TEST DATA>>
    }