Esempio n. 1
0
        public WorldScript PlaceWorldscript(int pixelX, int pixelY, string className)
        {
            var ret = new WorldScript(pixelX, pixelY, className);

            WorldScripts.Add(ret);
            return(ret);
        }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     moved = false;
     move  = Random.Range(0.0f, 1.0f);                                                 //Gets the random loction the hook will go.
     world = GameObject.FindGameObjectWithTag("world").GetComponent <WorldScript>();
     transform.position = new Vector3(transform.position.x, Random.Range(-4f, 4f), 0); //Spawns hook on a random location on the Y axis
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        if (GameObject.FindGameObjectsWithTag("WORLD").Length > 0)
        {
            WorldScript world = GameObject.FindGameObjectsWithTag("WORLD")[0].GetComponent <WorldScript>();
            world.AddAlpaca(this);
        }

        if (GameObject.Find("MusicTime") != null)
        {
            music = GameObject.Find("MusicTime").GetComponent <AudioSource>();
        }

        if (music != null)
        {
            music.volume = 0.3f;
        }

        dest_y = -100;

        Vector3 tmp = GetCurrAlpacaLocation();

        tmp.y -= OFFSET;
        gameObject.transform.position = tmp;
    }
Esempio n. 4
0
        public void FoldTerrain()
        {
            int[,,] world = WorldScript.GenerateTerrain(128, 128);
            Dictionary <int, int[, , ]> folds = WorldScript.FoldTerrain(world, 128, 128);

            Assert.AreEqual(8, folds.Count);
        }
Esempio n. 5
0
    public int[] itemInventory_;        //0 : none, 1: buy, 2: buy and used

    private void Awake()
    {
        playerScript_ = GameObject.Find("Player").GetComponent <PlayerScript>();
        worldScript_  = gameObject.GetComponent <WorldScript>();
        stageLoader_  = gameObject.GetComponent <StageLoader>();
        shopScript_   = GameObject.Find("ShopUI").GetComponent <ShopScript>();

        TimeText_     = GameObject.Find("UI").transform.Find("Time").GetComponent <Text>();
        FishText_     = GameObject.Find("UI").transform.Find("Fish").GetComponent <Text>();
        DistanceText_ = GameObject.Find("UI").transform.Find("Distance").GetComponent <Text>();
        SpeedText_    = GameObject.Find("UI").transform.Find("Speed").GetComponent <Text>();

        // create object instanace
        fishPool_      = new GameObject[FISH_INSCREEN_MAX_NUM];
        largeHolePool_ = new GameObject[LARGE_HOLE_INSCREEN_MAX_NUM];
        fishHolePool_  = new GameObject[FISH_HOLE_INSCREEN_MAX_NUM];
        crackPool_     = new GameObject[CRACK_INSCREEN_MAX_NUM];
        rockPool_      = new GameObject[ROCK_INSCREEN_MAX_NUM];
        shopPool_      = new GameObject[SHOP_INSCREEN_MAX_NUM];

        DebugText_ = GameObject.Find("UI").transform.Find("Debug").GetComponent <Text>();

        itemInventory_ = new int[(int)Constant.ItemDef.TOTALITEMCOUNT];
        for (int i = 0; i < (int)Constant.ItemDef.TOTALITEMCOUNT; ++i)
        {
            itemInventory_[i] = 0;
        }
        //currentStage_ = 1;
    }
Esempio n. 6
0
 private void Start()
 {
     if (this.Spawn == null)
     {
         this.Spawn = FindObjectOfType <Spawn>();
     }
     if (this.HudController == null)
     {
         this.HudController = FindObjectOfType <HUDController>();
     }
     if (this.CameraController == null)
     {
         this.CameraController = FindObjectOfType <CameraController>();
     }
     if (this.WorldScript == null)
     {
         this.WorldScript = FindObjectOfType <WorldScript>();
     }
     if (this.AudioController == null)
     {
         this.AudioController = FindObjectOfType <AudioController>();
     }
     this.disasterCount = new int[GameVariables.Desatres.GetNames(typeof(GameVariables.Desatres)).Length];
     this.HudController.SetGameController(this);
     this.CameraController.SetGameController(this);
 }
    public static void CallBack(ROSBridgeMsg msg)
    {
        EnvironmentMsg poseMsg = (EnvironmentMsg)msg;

        if (poseMsg.id_.Contains("hoop"))
        {
            char numID = poseMsg.id_[poseMsg.id_.Length - 1];
            //Debug.Log("Got a tf message: " + poseMsg.id_[poseMsg.id_.Length - 1]);

            GameObject currentHoop = null;
            GameObject hoopLabel   = null;

            if (!WorldScript.hoopsDict.ContainsKey(numID))
            {
                GameObject world = GameObject.FindWithTag("World");
                currentHoop = Object.Instantiate(world.GetComponent <WorldScript>().torus);
                currentHoop.transform.parent = world.transform;
                WorldScript.hoopsDict[numID] = currentHoop;
                Debug.Log("Made hoop with id: " + numID);
            }
            else
            {
                currentHoop = WorldScript.hoopsDict[numID];
            }

            currentHoop.transform.localPosition = WorldScript.RosSpaceToWorldSpace(poseMsg.x_, poseMsg.y_, poseMsg.z_) + new Vector3(0.31f, 0f, 0f);
            currentHoop.transform.localScale    = new Vector3(3.3f, 3.3f, 3.3f);
            currentHoop.transform.localRotation = new Quaternion(poseMsg.x_rot_ + 1, poseMsg.y_rot_, poseMsg.z_rot_, poseMsg.w_rot_);
        }
    }
 void Start()
 {
     instance           = this;
     isRunningItemSerch = false;
     debugMode          = false;
     listaObjetos       = new List <GameObject>();
     listarObjetos      = false;
 }
 public static bool deleteOET(WorldScript world, Segment segment, long x, long y, long z, ushort leType)
 {
     if (!MobSpawnManager.mbSurfaceAttacksActive && config.getBoolean(FTConfig.ConfigEntries.OET))
     {
         return(true);
     }
     return(world.BuildFromEntity(segment, x, y, z, leType));
 }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     ws         = WorldScript.getInstance();
     score.text = "";
     for (int i = 0; i < 5; i++)
     {
         score.text += ws.getName(i) + " : " + ws.getHighScore(i) + "\n";
     }
 }
    public static WorldScript getInstance()
    {
        if (instance == null)
        {
            instance = new WorldScript();
        }

        return(instance);
    }
Esempio n. 12
0
    // Start is called before the first frame update
    protected void Awake()
    {
        GameObject gj = GameObject.Find("MainGrid");

        mainGrid   = gj.GetComponent <Grid>();
        controller = gj.GetComponent <WorldScript>();
        SetPos();
        controller.SetToGrid(this, x, y);
    }
Esempio n. 13
0
 private void Awake()
 {
     ActiveWorld    = this;
     _target        = Instantiate(Resources.Load("Prefabs/TargetPrefab") as GameObject, new Vector3(0, 0, 0), Quaternion.identity);
     _baseChunk     = Instantiate(Resources.Load("Prefabs/ChunkPrefab") as GameObject, new Vector3(0, 0, 0), Quaternion.identity);
     BaseBlock      = Instantiate(Resources.Load("Prefabs/BlockPrefab") as GameObject, new Vector3(0, 0, 0), Quaternion.identity);
     _physicsPrefab = Instantiate(Resources.Load("Prefabs/PhysicsPrefab") as GameObject, new Vector3(0, 0, 0), Quaternion.identity);
     gameObject.SetActive(true);
     Debug.Log("Awake");
 }
 void Start()
 {
     /**
      * Declare this block to the World object
      */
     if (GameObject.FindGameObjectsWithTag("WORLD").Length > 0)
     {
         WorldScript world = GameObject.FindGameObjectsWithTag("WORLD")[0].GetComponent <WorldScript>();
         world.AddBlock(name, new Vector3(0, 0, 0), gameObject.transform.position, this);
     }
 }
Esempio n. 15
0
    void Start()
    {
        obj   = gameObject;
        trans = transform;
        ws    = WorldScript.getInstance();

        boundaryLeft  = 1f;
        boundaryRight = 9.5f;
        GO_RIGHT      = true;
        DELAY         = 0.75f;

        StartCoroutine(MiniPause());
    }
Esempio n. 16
0
 public PlayerController(int ctrNum, int carNum, int pNum, Transform spawnP, GameObject cam, WorldScript _world)
 {
     world = _world;
     playerNum = pNum;
     controllerNum = ctrNum;
     whichCar = carNum;
     spawnPoint = spawnP;
     cameraFab = cam;
     ui = new UIScript(world.UIs[0],ctrNum,this,world.players.Count);
     //currentChunk = startChunk;
     initCar();
     powerballManager = new PowerballManager(carScript.PowerBall, this);
 }
Esempio n. 17
0
 public PlayerController(int ctrNum, int carNum, int pNum, Transform spawnP, GameObject cam, WorldScript _world)
 {
     world         = _world;
     playerNum     = pNum;
     controllerNum = ctrNum;
     whichCar      = carNum;
     spawnPoint    = spawnP;
     cameraFab     = cam;
     ui            = new UIScript(world.UIs[0], ctrNum, this, world.players.Count);
     //currentChunk = startChunk;
     initCar();
     powerballManager = new PowerballManager(carScript.PowerBall, this);
 }
Esempio n. 18
0
    private void SendROSModifyMessage()
    {
        //TODO: Determine Why Tom has height being set to worldPos on edit (Kind of breaks the ability to edit)
        WorldScript ws = GameObject.Find("World").GetComponent <WorldScript>();

        string prevID            = ws.GetPrevID(this.name, "modify");
        float  worldX            = this.transform.localPosition.x;
        float  worldZ            = this.transform.localPosition.z;
        float  height            = this.worldPos.y;
        UserpointInstruction msg = new UserpointInstruction(this.name, prevID, worldX, height, worldZ, "MODIFY");

        GameObject.Find("Master").GetComponent <ROSDroneConnection>().PublishWaypointUpdateMessage(msg);
    }
Esempio n. 19
0
 // Start is called before the first frame update
 void Start()
 {
     if (GameObject.FindGameObjectsWithTag("WORLD").Length > 0)
     {
         WorldScript world = GameObject.FindGameObjectsWithTag("WORLD")[0].GetComponent <WorldScript>();
         world.AddBlockButt(this);
     }
     SetToDeactivated();
     orange      = new Color(1, 0.8666f, 0.4f, 1);
     lightOrange = new Color(1, 0.8666f, 0.4f, 0.5f);
     lightWhite  = new Color(1f, 1f, 1f, 0.6f);
     pickUp      = false;
 }
 // Use this for initialization
 void Start()
 {
     ws = WorldScript.getInstance();
     for (int i = 4; i >= 0; i--)
     {
         if (ws.GetScore() > ws.getHighScore(i))
         {
             place = i;
         }
     }
     ;
     score.text = "Score : " + ws.GetScore();
     input.text = "Player";
 }
 public static bool doOETBlockEffects(WorldScript world, long x0, long y0, long z0, int size, int hardness)
 {
     if (MobSpawnManager.mbSurfaceAttacksActive || !config.getBoolean(FTConfig.ConfigEntries.OET))
     {
         //	WorldScript.instance.Explode(x0, y0, z0, size, hardness);
         return(WorldScript.instance.SafeExplode(x0, y0, z0, size));
     }
     else
     {
         clearSoftResin(x0, y0, z0, size);
         killWorms(x0, y0, z0, size);
         return(true);
     }
 }
Esempio n. 22
0
 protected void Start()
 {
     playing         = false;
     worldRef        = GameObject.FindWithTag("WORLD").GetComponent <WorldScript>();
     overworldCamera = GameObject.FindWithTag("MainCamera");
     initPos         = canvasTransform.anchoredPosition;
     initScale       = canvasTransform.localScale;
     if (worldRef != null)
     {
         worldRef.SetMinigameMode(true);
         worldRef.comicController.SlideComicLeftAndOut(moveSpeed);
     }
     AudioManager.PlaySound("RecordScratch");
 }
Esempio n. 23
0
    // Use this for initialization
    void Start()
    {
        obj   = gameObject;
        trans = transform;
        ws    = WorldScript.getInstance();

        obj.GetComponent <Rigidbody>().constraints =
            RigidbodyConstraints.FreezeAll;

        Cooldown = false;

        nextFire = Random.Range(Time.timeSinceLevelLoad, Time.timeSinceLevelLoad + 20);
        time     = 0;
    }
Esempio n. 24
0
    // Use this for initialization
    void Start()
    {
        RBComp = GetComponent <Rigidbody2D>();
        RBComp.gravityScale = UnderWaterGravityScale;

        AnimCtrl   = GetComponent <Animator>();
        bShipEaten = false;

        AudioComp = GetComponent <AudioSource>();
        WorldInfo = GameObject.FindGameObjectWithTag("World").GetComponent <WorldScript>();

        ShipsDestroyed = 0;
        ShipsEaten     = 0;
        ShipsFed       = 0;
    }
Esempio n. 25
0
    // Use this for initialization
    void Start()
    {
        Hunger = 1.0f;
        PC     = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();

        AnimCtrl  = GetComponent <Animator>();
        AudioComp = GetComponent <AudioSource>();
        WorldInfo = GameObject.FindGameObjectWithTag("World").GetComponent <WorldScript>();

        GrownBabies = GameObject.FindGameObjectsWithTag("GrownBaby");
        foreach (GameObject obj in GrownBabies)
        {
            obj.SetActive(false);
        }
    }
Esempio n. 26
0
    public bool isActive, spawnedBoiz; //Den sparningen som startar om man klickar continue

    public WorldData(WorldScript world)
    {
        gold        = world.gold;
        rs          = world.rs;
        saveId      = world.saveId;
        storageSize = world.storageSize;
        shopSize    = world.stockSize;
        shopLevel   = world.shopLevel;
        storageArr  = world.storageArr;
        shopArr     = world.shopArr;
        isActive    = world.isActive;
        saveName    = world.saveName;
        partySize   = world.partySize;
        spawnedBoiz = world.spawnedBoiz;
    }
Esempio n. 27
0
    // Use this for initialization
    void Start()
    {
        Hunger = 1.0f;
        PC = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();

        AnimCtrl = GetComponent<Animator>();
        AudioComp = GetComponent<AudioSource>();
        WorldInfo = GameObject.FindGameObjectWithTag("World").GetComponent<WorldScript>();

        GrownBabies = GameObject.FindGameObjectsWithTag("GrownBaby");
        foreach(GameObject obj in GrownBabies)
        {
            obj.SetActive(false);
        }
    }
Esempio n. 28
0
 void Start()
 {
     obj      = gameObject;
     trans    = transform;
     ws       = WorldScript.getInstance();
     Cooldown = false;
     if (ws.isHARD() == false)
     {
         bull = 3;
     }
     else
     {
         bull = 1;
     }
 }
Esempio n. 29
0
    // Use this for initialization
    void Start()
    {
        botSpawn  = false;
        midSpawn  = false;
        backSpawn = false;

        world = GameObject.FindGameObjectWithTag("world").GetComponent <WorldScript>();

        //Sets a specific spawn point for the initial background parts.
        botclone = Instantiate(bot, transform.position, Quaternion.Euler(0, 0, 0));
        botclone.transform.position = new Vector3(8.516859f, -.69f, 0);
        midclone = Instantiate(mid, transform.position, Quaternion.Euler(0, 0, 0));
        midclone.transform.position = new Vector3(5.41f, -.4362f, 0);
        backclone = Instantiate(back, transform.position, Quaternion.Euler(0, 0, 0));
        backclone.transform.position = new Vector3(45.37f, -2.76f, 0);
    }
    // Use this for initialization
    void Start()
    {
        PlayImage  = GameObject.Find("PlayImage");
        PauseImage = GameObject.Find("PauseImage");

        // We can't be playing in the beginning.
        isPlaying = false;

        // Image we want to have appear is Play.
        ps = PlayState.Play;

        standard = this.GetComponent <Renderer>().material.color;
        tg       = this.GetComponent <TapGesture>();

        GameObject world = GameObject.Find("World");

        ws = world.GetComponent <WorldScript>();
    }
Esempio n. 31
0
    void Start()
    {
        worldObject  = GameObject.Find("World");
        world        = worldObject.GetComponent <WorldScript>();
        canvasObject = GameObject.Find("Canvas");

        highlightObject = transform.Find("Highlight").gameObject;
        highlightObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0.5f);

        OwnedLands = new List <GameObject>();

        //AgentProfession = Profession.Unemployed;
        AgentName = "Another " + AgentProfession.ToString();
        InitAgentUI();

        animator = GetComponent <Animator>();

        SetAgentSprite();
    }
Esempio n. 32
0
    // Use this for initialization
    void Start()
    {
        RBComp    = GetComponent <Rigidbody2D>();
        AnimCtrl  = GetComponent <Animator>();
        AudioComp = GetComponent <AudioSource>();

        EatenBy = null;

        GameObject       playerObj = GameObject.FindGameObjectWithTag("Player");
        PlayerController pc        = playerObj.GetComponent <PlayerController>();

        WorldInfo = GameObject.FindGameObjectWithTag("World").GetComponent <WorldScript>();

        WaterLineY = pc.WaterLineY;

        Direction = (float)Random.Range(-2500, 2500) / 100.0f;

        bHasHarpoon = true;
    }
Esempio n. 33
0
    // Use this for initialization
    void Start()
    {
        RBComp = GetComponent<Rigidbody2D>();
        RBComp.gravityScale = UnderWaterGravityScale;

        AnimCtrl = GetComponent<Animator>();
        bShipEaten = false;

        AudioComp = GetComponent<AudioSource>();
        WorldInfo = GameObject.FindGameObjectWithTag("World").GetComponent<WorldScript>();

        ShipsDestroyed = 0;
        ShipsEaten = 0;
        ShipsFed = 0;
    }
Esempio n. 34
0
 void assignWorld(WorldScript _world)
 {
     world = _world;
 }
Esempio n. 35
0
 /// <summary>
 /// Creates a drama manager for a given world.
 /// </summary>
 /// <param name="world">The world in which the story should occur.</param>
 public DramaManager(WorldScript world)
 {
     this.World = world;
     this.EpisodeFinished = true;
 }
Esempio n. 36
0
    // Use this for initialization
    void Start()
    {
        RBComp = GetComponent<Rigidbody2D>();
        AnimCtrl = GetComponent<Animator>();
        AudioComp = GetComponent<AudioSource>();

        EatenBy = null;

        GameObject playerObj = GameObject.FindGameObjectWithTag("Player");
        PlayerController pc = playerObj.GetComponent<PlayerController>();
        WorldInfo = GameObject.FindGameObjectWithTag("World").GetComponent<WorldScript>();

        WaterLineY = pc.WaterLineY;

        Direction = (float)Random.Range(-2500, 2500) / 100.0f;

        bHasHarpoon = true;
    }
    /// <summary>
    /// Start is called once on object creation
    /// </summary>
    private void Start()
    {
        // SEED IS HARDCODED IN DEBUG MODE
        if (debugMode)
        { Random.seed = 71; }

        instance = this;

        // Sets up the sky state dictionary
        currSkyState = SkyStateType.Day;
        skyStates = new Dictionary<SkyStateType, SkyState>();
        skyStates.Add(SkyStateType.Dawn, new SkyState(SkyStateType.DawnToDay, Constants.ORANGE_SKY_COLOR, Constants.ORANGE_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.ORANGE_TIME_PCT, Constants.ORANGE_DARKNESS_COLOR, Constants.ORANGE_DARKNESS_COLOR, Constants.BGM_MAX_VOLUME, 0, daySound));
        skyStates.Add(SkyStateType.DawnToDay, new SkyState(SkyStateType.Day, Constants.ORANGE_SKY_COLOR, Constants.DAY_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.FADE_TIME_PCT, Constants.ORANGE_DARKNESS_COLOR, Constants.DAY_DARKNESS_COLOR, 0, Constants.BGM_MAX_VOLUME));
        skyStates.Add(SkyStateType.Day, new SkyState(SkyStateType.DayToDusk, Constants.DAY_SKY_COLOR, Constants.DAY_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.DAY_TIME_PCT, Constants.DAY_DARKNESS_COLOR, Constants.DAY_DARKNESS_COLOR));
        skyStates.Add(SkyStateType.DayToDusk, new SkyState(SkyStateType.Dusk, Constants.DAY_SKY_COLOR, Constants.ORANGE_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.FADE_TIME_PCT, Constants.DAY_DARKNESS_COLOR, Constants.ORANGE_DARKNESS_COLOR));
        skyStates.Add(SkyStateType.Dusk, new SkyState(SkyStateType.DuskToNight, Constants.ORANGE_SKY_COLOR, Constants.ORANGE_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.ORANGE_TIME_PCT, Constants.ORANGE_DARKNESS_COLOR, Constants.ORANGE_DARKNESS_COLOR, Constants.BGM_MAX_VOLUME, 0, nightSound));
        skyStates.Add(SkyStateType.DuskToNight, new SkyState(SkyStateType.Night, Constants.ORANGE_SKY_COLOR, Constants.NIGHT_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.ORANGE_TIME_PCT, Constants.ORANGE_DARKNESS_COLOR, Constants.NIGHT_DARKNESS_COLOR, 0, Constants.BGM_MAX_VOLUME));
        skyStates.Add(SkyStateType.Night, new SkyState(SkyStateType.NightToDawn, Constants.NIGHT_SKY_COLOR, Constants.NIGHT_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.NIGHT_TIME_PCT, Constants.NIGHT_DARKNESS_COLOR, Constants.NIGHT_DARKNESS_COLOR));
        skyStates.Add(SkyStateType.NightToDawn, new SkyState(SkyStateType.Dawn, Constants.NIGHT_SKY_COLOR, Constants.ORANGE_SKY_COLOR, Constants.CYCLE_TIME *
            Constants.FADE_TIME_PCT, Constants.NIGHT_DARKNESS_COLOR, Constants.ORANGE_DARKNESS_COLOR));

        // Starts the sky timer
        skyTimer = new Timer(skyStates[currSkyState].TimeInState);
        skyTimer.Register(SkyTimerFinished);
        skyTimer.Start();

        parallaxBackgrounds = GameObject.FindGameObjectsWithTag(Constants.PARALLAX_BACKGROUND_TAG);
        starrySky.transform.rotation = Quaternion.Euler(0, 0, Constants.SKY_START_ROT);

        BGM = GetComponent<AudioSource>();
        BGM.volume = Constants.BGM_MAX_VOLUME;

        elevationWeight = Constants.ELEVATION_CHANGE_WEIGHT + Random.Range(-Constants.ELEVATION_CHANGE_OFFSET, Constants.ELEVATION_CHANGE_OFFSET); ;
        heightDifferenceWeight = Constants.HEIGHT_DIFFERENCE_WEIGHT + Random.Range(-Constants.HEIGHT_DIFFERENCE_OFFSET, Constants.HEIGHT_DIFFERENCE_OFFSET);

        if (debugMode)
        {
            Debug.Log("Elevation weight: " + elevationWeight);
            Debug.Log("Height Difference Weight: " + heightDifferenceWeight);
        }

        // Generates the map
        GenerateTerrain();
        GenerateParallaxObjects();

        // Spawns castles
        int enemyCastlePos = levels.Length - (Constants.PLATFORM_LENGTH - 4);
        Instantiate(GameManager.Instance.CastlePrefabs[GameManager.Instance.CurrentLoadedKingdom]).GetComponent<CastleScript>().Initialize(enemyCastleHealth,
            Constants.ENEMY_TAG, new Vector2(enemyCastlePos, levels[enemyCastlePos] + 1));
        Instantiate(GameManager.Instance.CastlePrefabs[GameManager.Instance.GetPrevKingdom()]).GetComponent<CastleScript>().Initialize(playerCastleHealth,
            Constants.PLAYER_TAG, playerCastleLocation);

        // Sets up the defeat darkness
        defeatDarknessTimer = new Timer(Constants.DARKNESS_TIMER);
        defeatDarknessTimer.Register(DefeatDarknessTimerFinished);

        // Creates the player and HUD
        player = (GameObject)Instantiate(GameManager.Instance.PlayerPrefabs[GameManager.Instance.CurrentSave.PlayerType],
            playerCastleLocation, transform.rotation);
        GameObject hud;
        switch (GameManager.Instance.CurrentSave.PlayerType)
        {
            case CharacterType.Ranger:
                hud = Instantiate<GameObject>(rangerHUD);
                break;
            case CharacterType.Mage:
                hud = Instantiate<GameObject>(mageHUD);
                break;
            case CharacterType.Warrior:
                hud = Instantiate<GameObject>(warriorHUD);
                break;
            default:
                hud = Instantiate<GameObject>(rangerHUD);
                break;
        }
        hud.transform.SetParent(hudParent, false);
        HUDScript hudScript = hud.GetComponent<HUDScript>();
        player.GetComponent<PlayerScript>().Initialize(healthBar, energyBar, hudScript.GcdBars, hudScript.TimerBars, hudScript.SecondaryCDBar,
            hudScript.PowerCDBar, hudScript.SpecialCDBar);
        energyBar.color = player.GetComponent<CharacterScript>().EnergyColor;
        playerLocation = player.transform.position;
    }