示例#1
0
        public override void Dispose()
        {
            for (int i = 0; i < levelObjects.Count; i++)
            {
                if (levelObjects[i] is GameObject)
                {
                    ((GameObject)levelObjects[i]).Destroy();
                }
                else if (levelObjects[i] is ObjectComponent)
                {
                    ((ObjectComponent)levelObjects[i]).Destroy();
                }
            }

            levelObjects.Clear();

            levelExits.Clear();

            for (int i = 0; i < levelAssets.Count; i++)
            {
                levelAssets[i].LevelTransitionOff(levelName);
            }

            levelAssets.Clear();

            updateables.Clear();

            playerStart = null;

            base.Dispose();
        }
示例#2
0
        public override void Dispose()
        {
            for (int i = 0; i < gameObjects.Count; i++)
            {
                gameObjects[i].Destroy();
            }

            gameObjects.Clear();

            levelExits.Clear();

            for (int i = 0; i < levelAssets.Count; i++)
            {
                if (levelAssets[i] != null)
                {
                    levelAssets[i].LevelTransitionOff(levelName);
                }
            }

            levelAssets.Clear();

            updateables.Clear();

            playerStart = null;

            base.Dispose();
        }
示例#3
0
    public override void OnInspectorGUI()
    {
        PlayerStart _target = (PlayerStart)target;

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Previous scene that activates", EditorStyles.boldLabel);
        _target.chooseSceneBy = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose scene by:", _target.chooseSceneBy);
        if (_target.chooseSceneBy == ChooseSceneBy.Name)
        {
            _target.previousSceneName = EditorGUILayout.TextField("Previous scene:", _target.previousSceneName);
        }
        else
        {
            _target.previousScene = EditorGUILayout.IntField("Previous scene:", _target.previousScene);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);
        _target.cameraOnStart = (_Camera)EditorGUILayout.ObjectField("Camera on start:", _target.cameraOnStart, typeof(_Camera), true);
        _target.fadeInOnStart = EditorGUILayout.Toggle("Fade in on start?", _target.fadeInOnStart);
        if (_target.fadeInOnStart)
        {
            _target.fadeSpeed = EditorGUILayout.FloatField("Fade speed:", _target.fadeSpeed);
        }
        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(_target);
        }
    }
示例#4
0
        private string GetPlayers(PlayerStart playerStart)
        {
            List <string> playersAsStringArray = new List <string>();

            switch (playerStart)
            {
            case PlayerStart.StartingEleven:
                foreach (var teamEvent in Starting_eleven)
                {
                    playersAsStringArray.Add(teamEvent.ToString());
                }
                break;

            case PlayerStart.Substitute:
                foreach (var teamEvent in Substitutes)
                {
                    playersAsStringArray.Add(teamEvent.ToString());
                }
                break;
            }

            string players = string.Join("\n\t", playersAsStringArray.ToArray());

            return(players);
        }
    // Use this for initialization
    void Start()
    {
        this.restartTime    = Time.timeSinceLevelLoad;
        this.pendingRecords = new List <PlayerRecord>();
        this.activeRecords  = new List <PlayerRecord>();

        this.playerReplayObjects = new List <GameObject>();
        this.playerStart         = this.GetComponentInChildren <PlayerStart>();
    }
示例#6
0
    private void InitialiseObjects()
    {
        Undo.RegisterSceneUndo("Organise room objects");

        CreateFolder("_Cameras");
        CreateFolder("_Cutscenes");
        CreateFolder("_DialogueOptions");
        CreateFolder("_Interactions");
        CreateFolder("_Lights");
        CreateFolder("_Logic");
        CreateFolder("_Navigation");
        CreateFolder("_NPCs");
        CreateFolder("_Sounds");
        CreateFolder("_SetGeometry");

        // Create subfolders
        CreateSubFolder("_Cameras", "_GameCameras");

        CreateSubFolder("_Logic", "_ArrowPrompts");
        CreateSubFolder("_Logic", "_Conversations");
        CreateSubFolder("_Logic", "_Hotspots");
        CreateSubFolder("_Logic", "_Triggers");

        CreateSubFolder("_Navigation", "_CollisionCubes");
        CreateSubFolder("_Navigation", "_CollisionCylinders");
        CreateSubFolder("_Navigation", "_Markers");
        CreateSubFolder("_Navigation", "_NavMesh");
        CreateSubFolder("_Navigation", "_Paths");
        CreateSubFolder("_Navigation", "_PlayerStarts");

        // Delete default main camera
        if (GameObject.FindWithTag(Tags.mainCamera))
        {
            GameObject mainCam = GameObject.FindWithTag(Tags.mainCamera);
            if (mainCam.GetComponent <MainCamera>() == null)
            {
                DestroyImmediate(mainCam);
            }
        }

        // Create main camera
        AddPrefab("Automatic", "MainCamera", false, false, false);
        PutInFolder(GameObject.FindWithTag(Tags.mainCamera), "_Cameras");

        // Create Game engine
        AddPrefab("Automatic", "GameEngine", false, false, false);

        // Assign Player Start
        SceneSettings startSettings = GameObject.FindWithTag(Tags.gameEngine).GetComponent <SceneSettings>();

        if (startSettings && startSettings.defaultPlayerStart == null)
        {
            PlayerStart playerStart = AddPrefab("Navigation", "PlayerStart", false, false, true).GetComponent <PlayerStart>();
            startSettings.defaultPlayerStart = playerStart;
        }
    }
示例#7
0
    public Vector2 Debug_PlayerStartPosLocal()
    {
        PlayerStart playerStart = GetComponentInChildren <PlayerStart>();

        if (playerStart != null)
        {
            return(playerStart.PosLocal);
        }
        return(Vector2.zero); // no PlayerStart? Ok, default to my center.
    }
示例#8
0
        private void InvokePlayerStart(string trackName)
        {
            PlayerStartEventArgs e = new PlayerStartEventArgs()
            {
                SampleRate  = reader.WaveFormat.SampleRate,
                TrackLength = reader.TotalTime,
                TrackName   = trackName
            };

            PlayerStart?.Invoke(this, e);
        }
示例#9
0
    // Use this for initialization
    void Start()
    {
        if (sharedInstance != null)
        {
            Destroy(sharedInstance.gameObject);
        }

        sharedInstance = this;

        if (!isSpawned)
        {
            SpawnPlayer();
            isSpawned = true;
        }
    }
示例#10
0
    void MovePlayerToStart()
    {
        Vector3 pos;

        if (checkpointLocation != null)
        {
            pos = checkpointLocation.position;
        }
        else
        {
            PlayerStart ps = GameObject.FindObjectOfType <PlayerStart>();
            pos = ps.transform.position;
        }

        activePlayer.transform.position = pos;
    }
示例#11
0
    // Use this for initialization
    void Start()
    {
        // If another PlayerStart exists, this will replace it
        if (_instance != null)
        {
            Destroy(_instance.gameObject);
        }

        _instance = this;

        // Have we spawned yet? If not, spawn the player
        if (!spawned)
        {
            SpawnPlayer();
            spawned = true;
        }
    }
    // Use this for initialization
    void Start()
    {
        battlePlayer = GameObject.Find("Combat").GetComponent <BattleSystem> ();
        playerStart  = GameObject.Find("PlayerNap").GetComponent <PlayerStart> ();
        napsack      = GameObject.Find("Combat").GetComponent <Napsack> ();

        HP = GameObject.Find("HP");
        SP = GameObject.Find("SP");

        HPrectTEMP = battlePlayer.HPrectTEMP;
        SPrectTEMP = battlePlayer.SPrectTEMP;

        HPrect   = battlePlayer.HPrect;
        SPrect   = battlePlayer.SPrect;
        napsack  = GameObject.Find("Combat").GetComponent <Napsack> ();
        hpChange = hpChange / playerStart.getbasePHP();
        spChange = spChange / playerStart.getbaseSHP();
    }
示例#13
0
    private void Awake()
    {
        DontDestroyOnLoad(this);

        if (player == null)
        {
            player = this;
        }
        else
        {
            Destroy(gameObject);
        }

        if (playerStart == null)
        {
            playerStart = FindObjectOfType <PlayerStart>();
        }

        gameObject.transform.position = playerStart.GetPosition();

        source = GetComponent <AudioSource>();
    }
示例#14
0
    private void Start()
    {
        PlayerStart[] playerStartPositions = LevelInstance.Singleton.StartPositions;
        PlayerStart   startPosition        = null;

        foreach (PlayerStart startPos in playerStartPositions)
        {
            if (startPos.ID == GameInstance.Singleton.ToID)
            {
                startPosition = startPos;
                break;
            }
        }

        if (startPosition == null)
        {
            Debug.LogWarning("No Player Start Position for " + gameObject.name);
            return;
        }

        startPosition.Spawn(gameObject.GetComponent <PlayerController>());
    }
示例#15
0
 private void OnLevelWasLoaded(int level)
 {
     playerStart = FindObjectOfType <PlayerStart>();
     gameObject.transform.position = playerStart.GetPosition();
 }
示例#16
0
        /// <summary>
        /// Initializes the Level.
        /// </summary>
        /// <param name="levelInfoFilepath">The filepath for the
        /// file where this Level is going to get it's information from.</param>
        internal void Initate(string levelInfoFilepath)
        {
            LevelInfo info = Common.ContentManager.Load <LevelInfo>(levelInfoFilepath);

            levelName = info.LevelName;

            for (int i = 0; i < info.LevelObjects.Length; i++)
            {
                object obj = AssemblyManager.CreateInstance(info.LevelObjects[i]);

                if (obj is ILevelAsset)
                {
                    if (levelAssets.Count > 0)
                    {
                        obj = (from a in levelAssets
                               where a.ID == (obj as ILevelAsset).ID
                               select a).FirstOrDefault();

                        if (obj == null)
                        {
                            levelAssets.Add(obj as ILevelAsset);
                        }
                    }
                    else
                    {
                        levelAssets.Add(obj as ILevelAsset);
                    }
                }

                if (obj is PlayerStart)
                {
                    if (playerStart == null)
                    {
                        playerStart = obj as PlayerStart;
                    }
                    else
                    {
                        throw new ArgumentException("Their is already a PlayerStart object in this Level. The object: "
                                                    + (obj as PlayerStart).ID + " is invalid and will not be used.");
                    }
                }

                if (obj is IExit)
                {
                    levelExits.Add(obj as IExit);
                }

                if (obj is IUpdate)
                {
                    updateables.Add(obj as IUpdate);
                }

                if (obj is GameObject)
                {
                    ((GameObject)obj).AddReference(this);
                    gameObjects.Add(obj as GameObject);
                }
            }

            foreach (ILevelAsset asset in levelAssets)
            {
                if (asset != null)
                {
                    asset.LevelTransitionOn(levelName);
                }
            }
        }
示例#17
0
    // ----------------------------------------------------------------
    //	Initialize
    // ----------------------------------------------------------------
    public void Initialize(GameController _gameControllerRef, Transform tf_world, RoomData _roomData)
    {
        gameControllerRef    = _gameControllerRef;
        MyRoomData           = _roomData;
        this.gameObject.name = MyRoomData.RoomKey;

        GameUtils.ParentAndReset(this.gameObject, tf_world);
        this.transform.localPosition = PosGlobal; // Position me!

        // Initialize channels!
        gateChannels = new GateChannel[5];
        for (int i = 0; i < gateChannels.Length; i++)
        {
            gateChannels[i] = new GateChannel(this, i);
        }

        // Instantiate my props!
        RoomData         rd  = MyRoomData;
        ResourcesHandler rh  = ResourcesHandler.Instance;
        int numProgressGates = 0; // for deteriming their indexes.
        int numVeils         = 0; // for determining their indexes.

        foreach (PropData propData in rd.allPropDatas)
        {
            System.Type pt = propData.GetType();
            if (false)
            {
            }
            // Enemies
            else if (pt == typeof(DweebData))
            {
                Dweeb newProp = Instantiate(rh.Dweeb).GetComponent <Dweeb>();
                newProp.Initialize(this, propData as DweebData);
            }
            // Grounds
            else if (pt == typeof(CrateData))
            {
                Crate newProp = Instantiate(rh.Crate).GetComponent <Crate>();
                newProp.Initialize(this, propData as CrateData);
            }
            else if (pt == typeof(DispGroundData))
            {
                DispGround newProp = Instantiate(rh.DispGround).GetComponent <DispGround>();
                newProp.Initialize(this, propData as DispGroundData);
            }
            else if (pt == typeof(GateData))
            {
                Gate newProp = Instantiate(rh.Gate).GetComponent <Gate>();
                newProp.Initialize(this, propData as GateData);
                gateChannels[newProp.ChannelID].AddGate(newProp);
            }
            else if (pt == typeof(ToggleGroundData))
            {
                ToggleGround newProp = Instantiate(rh.ToggleGround).GetComponent <ToggleGround>();
                newProp.Initialize(this, propData as ToggleGroundData);
            }
            else if (pt == typeof(PlatformData))
            {
                Platform newProp = Instantiate(rh.Platform).GetComponent <Platform>();
                newProp.Initialize(this, propData as PlatformData);
            }
            else if (pt == typeof(GroundData))
            {
                Ground newProp = Instantiate(rh.Ground).GetComponent <Ground>();
                newProp.Initialize(this, propData as GroundData);
            }
            // Everything else!
            else if (pt == typeof(BatteryData))
            {
                Battery newProp = Instantiate(rh.Battery).GetComponent <Battery>();
                newProp.Initialize(this, propData as BatteryData);
            }
            else if (pt == typeof(BuzzsawData))
            {
                Buzzsaw newProp = Instantiate(rh.Buzzsaw).GetComponent <Buzzsaw>();
                newProp.Initialize(this, propData as BuzzsawData);
            }
            else if (pt == typeof(CharBarrelData))
            {
                CharBarrel newProp = Instantiate(rh.CharBarrel).GetComponent <CharBarrel>();
                newProp.Initialize(this, propData as CharBarrelData, charBarrels.Count);
                charBarrels.Add(newProp);
            }
            else if (pt == typeof(CharUnlockOrbData))
            {
                CharUnlockOrb newProp = Instantiate(rh.CharUnlockOrb).GetComponent <CharUnlockOrb>();
                newProp.Initialize(this, propData as CharUnlockOrbData);
            }
            else if (pt == typeof(CameraBoundsData))
            {
                CameraBounds newProp = Instantiate(rh.CameraBounds).GetComponent <CameraBounds>();
                newProp.Initialize(this, propData as CameraBoundsData);
            }
            else if (pt == typeof(GateButtonData))
            {
                GateButton newProp = Instantiate(rh.GateButton).GetComponent <GateButton>();
                newProp.Initialize(this, propData as GateButtonData);
                gateChannels[newProp.ChannelID].AddButton(newProp);
            }
            else if (pt == typeof(GemData))
            {
                Gem newProp = Instantiate(rh.Gem).GetComponent <Gem>();
                newProp.Initialize(this, propData as GemData, gems.Count);
                gems.Add(newProp);
            }
            else if (pt == typeof(InfoSignData))
            {
                InfoSign newProp = Instantiate(rh.InfoSign).GetComponent <InfoSign>();
                newProp.Initialize(this, propData as InfoSignData);
            }
            else if (pt == typeof(LaserData))
            {
                Laser newProp = Instantiate(rh.Laser).GetComponent <Laser>();
                newProp.Initialize(this, propData as LaserData);
            }
            else if (pt == typeof(LiftData))
            {
                Lift newProp = Instantiate(rh.Lift).GetComponent <Lift>();
                newProp.Initialize(this, propData as LiftData);
            }
            else if (pt == typeof(PlayerStartData))
            {
                PlayerStart newProp = Instantiate(rh.PlayerStart).GetComponent <PlayerStart>();
                newProp.Initialize(this, propData as PlayerStartData);
            }
            else if (pt == typeof(ProgressGateData))
            {
                ProgressGate newProp = Instantiate(rh.ProgressGate).GetComponent <ProgressGate>();
                newProp.Initialize(this, propData as ProgressGateData, numProgressGates++);
            }
            else if (pt == typeof(RoomDoorData))
            {
                RoomDoor newProp = Instantiate(rh.RoomDoor).GetComponent <RoomDoor>();
                newProp.Initialize(this, propData as RoomDoorData);
            }
            else if (pt == typeof(SnackData))
            {
                Snack newProp = Instantiate(rh.Snack).GetComponent <Snack>();
                newProp.Initialize(this, propData as SnackData, snacks.Count);
                snacks.Add(newProp);
            }
            else if (pt == typeof(SpikesData))
            {
                Spikes newProp = Instantiate(rh.Spikes).GetComponent <Spikes>();
                newProp.Initialize(this, propData as SpikesData);
            }
            else if (pt == typeof(TurretData))
            {
                Turret newProp = Instantiate(rh.Turret).GetComponent <Turret>();
                newProp.Initialize(this, propData as TurretData);
            }
            else if (pt == typeof(VeilData))
            {
                Veil newProp = Instantiate(rh.Veil).GetComponent <Veil>();
                newProp.Initialize(this, propData as VeilData, numVeils++);
            }
            else
            {
                Debug.LogWarning("PropData not recognized: " + propData);
            }
        }

        AddHardcodedRoomElements();

        // For development, add bounds so we don't fall out of unconnected rooms!
        AutoAddInvisibounds();
        roomGizmos.Initialize(this);
        shutters.Initialize(this);
    }
示例#18
0
 public static void AddStartstate(FlatBufferBuilder builder, PlayerStart startstate)
 {
     builder.AddSbyte(0, (sbyte)startstate, 0);
 }
    void Start()
    {
        Napsack combatNap = GameObject.Find("Combat").GetComponent <Napsack> ();

        combatNap.slotCount = 0;
        combatNap.fillSlots();


        PlayerMove = GameObject.Find("Player").GetComponent <PlayerMovement> ();
        PlayerMove.setinCombat(true);

        Player      = GameObject.Find("Player").GetComponent <Player> ();
        playerStart = GameObject.Find("PlayerNap").GetComponent <PlayerStart>();

        location = Player.GetComponent <Location> ();

        GameObject.Find("Player").GetComponent <InitiateDialogue> ().setA(false);


        Combat = GameObject.Find("Combat");

        stats = GameObject.Find("Stats_Icon").GetComponent <Stats> ();
        stats.setStatsCanOpen(false);


        ItemDropBool = GameObject.Find("ItemDropImage");
        ItemDropBool.SetActive(false);


        battleScreen = GameObject.Find("BattleScreen");

        battleScreen.SetActive(true);



        pHP = GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getPHP();

        sHP = GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getSHP();


        //Audio Clips

        AttackSound      = GameObject.Find("Attack").GetComponent <AudioSource>();
        BossSpecialSound = GameObject.Find("Boss Special").GetComponent <AudioSource>();
        PlayerSPSound    = GameObject.Find("Player Special").GetComponent <AudioSource>();
        WinSound         = GameObject.Find("WinSound").GetComponent <AudioSource>();



        //playerTurn
        playerTurn = true;

        //health bars
        HP = GameObject.Find("HP");
        SP = GameObject.Find("SP");
        EP = GameObject.Find("EP");

        //keeps track of health bar size


        HP.transform.localScale = new Vector3((pHP * .25f) / GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getbasePHP(), .4f, 0);
        SP.transform.localScale = new Vector3((sHP * .25f) / GameObject.Find("PlayerNap").GetComponent <PlayerStart>().getbaseSHP(), .4f, 0);
        EP.transform.localScale = new Vector3(.25f, .4f, 0);

        bossActive         = false;
        maajiActive        = Player.getMaajiActive();
        elliotActive       = Player.getElliotActive();
        sleepingGirlActive = Player.getSleepingGirlActive();
        dreamKeeperActive  = Player.getDreamKeeperActive();



        enemyAnimator = GameObject.Find("MonsterImage").GetComponent <Animator> ();

        noEscape = GameObject.Find("NoEscape");


        MonsterName = GameObject.Find("MonsterName").GetComponent <Text>();


        chooseMonster();

        monsterAttackCurrent = false;


        HPrectR    = HP.GetComponent <RectTransform> ();
        HPrect     = playerStart.getPHPBarSTATIC();
        HPrectTEMP = playerStart.getPHPBar();
//		print ("HPrecttempinitial: "+HPrectTEMP);
        HPincN = 5.0f / playerStart.getbasePHP();
        HPincS = 10.0f / playerStart.getbasePHP();
        System.Math.Round(HPincN, 2);
        System.Math.Round(HPincS, 2);

        SPrectR    = SP.GetComponent <RectTransform> ();
        SPrect     = playerStart.getSHPBarSTATIC();
        SPrectTEMP = playerStart.getSHPBar();
//		print ("SPrecttempinitial: "+SPrectTEMP);

        SPinc = 20.0f / playerStart.getbaseSHP();
        System.Math.Round(SPinc, 2);


        EPrectR    = EP.GetComponent <RectTransform> ();
        EPrect     = EPrectR.rect.width;
        EPrectTEMP = EPrect;
        EPincN     = 5.0f / eHP;
        EPincS     = 10.0f / eHP;
        System.Math.Round(EPincN, 2);
        System.Math.Round(EPincS, 2);



        //menu bar
        SelectionArrow = GameObject.Find("SelectionArrow");
        RectTransform arrowpos = SelectionArrow.GetComponent <RectTransform> ();

        arrowpos.anchoredPosition = new Vector2(-15f, -39.4f);



        menuPlaceHolder = 0;
        SPOut           = GameObject.Find("SPOut").GetComponent <RawImage>();
        //SPOut.SetActive (false);
        SPOut.enabled = false;

        //napsack
        Napsack = GameObject.Find("NapsackImage");
        Napsack.SetActive(false);
        NapsackActive = false;


        //log
        logText        = GameObject.Find("LogText").GetComponent <Text>();
        logText.text   = "Battle Start!";
        logTextfiller  = "";
        logTextTracker = 0;



        xButton = GameObject.Find("x");
        xButton.SetActive(false);

        //zButton = GameObject.Find("z");
        //zButton.SetActive(false);
    }
示例#20
0
 void Start()
 {
     playerStart = GameObject.Find("PlayerNap").GetComponent <PlayerStart> ();
 }
示例#21
0
 public void RegisterPlayerStart(PlayerStart _ps)
 {
     playerStart = _ps;
 }
        public override void Create()
        {
            Node n, n2;

            Mars = new Mars();
            //Mars.rotationspeed.Y = 15.0f / 180.0f * (float)Math.PI;
            Mars.Position = new Vector3(2000, 0, 3000);
            Spawn(Mars, true);

            Moon = new Moon();
            Moon.rotationspeed.Y = 15.0f / 180.0f * (float)Math.PI;
            Moon.Position        = new Vector3(1000, 0, 0);
            Moon.Attach          = Mars;
            Spawn(Moon, true);

            n = new Saturn();
            n.rotationspeed.Y = 10.0f / 180.0f * (float)Math.PI;
            n.Orientation     = QuaternionExtensions.FromAxisAngle(0, 1, 0, (float)Math.PI);
            n.Position        = new Vector3(-2000, 0, 3000);
            Spawn(n, true);

            DominationPoint dp = new DominationPoint();

            dp.Name          = "DomPoint 1";
            dp.Position      = new Vector3(2000, 0, 2000);
            dp.rotationspeed = new Vector3(0, 1, 0);
            Spawn(dp, false);

            CheckPoint cp = new CheckPoint();

            cp.CheckPointIndex = 0;
            cp.Position        = new Vector3(3000, 0, 2000);
            Spawn(cp, true);
            cp = new CheckPoint();
            cp.CheckPointIndex = 1;
            cp.Position        = new Vector3(4000, 0, 2000);
            Spawn(cp, true);

            VecRandom r      = new VecRandom();
            Vector3   center = new Vector3(-4000, 0, -2000);

            for (int i = 0; i < 20; ++i)
            {
                Vector3 rv = r.NextScaledVector3(3000, 300, 2000);
                n = new Phobos();
                Spawn(n, true);
                float s = 30.0f / 180.0f * (float)Math.PI;
                n.rotationspeed = r.NextScaledVector3(s, s, s);
                n.Position      = center + rv;
            }

            //if (Root.Instance is Server)
            {
                n = new SpawnPoint(typeof(Repair), 20);
                n.rotationspeed = new Vector3(0, 1, 0);
                n.Position      = new Vector3(-500, 0, 0);
                Spawn(n, true);
            }
            {
                n = new SpawnPoint(typeof(MissilePickup), 30);
                n.rotationspeed = new Vector3(0, 1, 0);
                n.Position      = new Vector3(2000, 0, -1000);
                Spawn(n, true);
            }

            {
                n = new PlayerStart();
                n.rotationspeed = new Vector3(0, 1, 0);
                n.Position      = new Vector3(4000, 0, 4000);
                Spawn(n, true);
            }
            {
                n = new PlayerStart();
                n.rotationspeed = new Vector3(0, 1, 0);
                n.Position      = new Vector3(-4000, 0, -4000);
                Spawn(n, true);
            }
            {
                n = new PlayerStart();
                n.rotationspeed = new Vector3(0, 1, 0);
                n.Position      = new Vector3(-4000, 0, 4000);
                Spawn(n, true);
            }
            {
                n = new PlayerStart();
                n.rotationspeed = new Vector3(0, 1, 0);
                n.Position      = new Vector3(4000, 0, -4000);
                Spawn(n, true);
            }

            {
                n = new Flag(1, new Vector3(4800, 0, -4800));
                Spawn(n, false);
            }
            {
                n = new Flag(0, new Vector3(4400, 0, -4400));
                Spawn(n, false);
            }

            //ParticleNebula pn = new ParticleNebula();
            n = new Nebula();
            //n.Draw.Add(pn);
            //n.Transparent = true;
            n.Position = new Vector3(0, 0, 0);
            Spawn(n, true);

            n = new Nebula();
            //n.Draw.Add(pn);
            //n.Transparent = true;
            n.Position = new Vector3(100, 0, 600);
            Spawn(n, true);

            //n = new LaserTurret();
            //n = new Nebula();
            //n.Draw.Add(pn);
            n = new PornCinema();

            //Text3D tx = new Cheetah.Text3D("abcabcabc", (MeshFont)Root.Instance.ResourceManager.Load("models/font-arial-black", typeof(MeshFont)));
            //n.Draw.Add(tx);
            n.Position    = new Vector3(300, 0, 1200);
            n.Orientation = QuaternionExtensions.FromAxisAngle(0, 1, 0, (float)Math.PI);
            Spawn(n, true);

            //n = new TestShip();
            //Root.Instance.Scene.Spawn(n);
            //n.Position = new Vector3(400, 0, 0);

            Light l = new Light();

            l.directional = true;
            l.Position    = Vector3Extensions.GetUnit(new Vector3(1, 3, 4));
            //l.directional = false;

            l.diffuse = new Color4f(0.5f, 0.8f, 1.0f, 1);
            Spawn(l, true);


            l             = new Light();
            l.Position    = new Vector3(0, 0, 0);
            l.directional = false;
            l.diffuse     = new Color4f(1, 0, 0, 1);
            Spawn(l, true);


            n = new EclipticNode();
            //n.Draw.Add(new Ecliptic(new Color3f(0, 0, 0.5f), 10000, 100));
            Spawn(n, true);

            //Spawn(new RandomSpawn(typeof(SpaceWar2006.Planets.PhobosAsteroid), 1, 1), true);
        }
示例#23
0
        /// <summary>
        /// Initializes the Level.
        /// </summary>
        /// <param name="levelInfoFilepath">The filepath for the
        /// file where this Level is going to get it's information from.</param>
        internal void Initate(string levelInfoFilepath)
        {
            LevelInfo info = Common.ContentManager.Load <LevelInfo>(levelInfoFilepath);

            levelName = info.LevelName;

            for (int i = 0; i < info.LevelObjects.Count; i++)
            {
                object obj = AssemblyManager.CreateInstance(info.LevelObjects[i]);

                if (!(obj is PlayerStart) || !(obj is ILevelAsset) || !(obj is IExit))
                {
                    if (obj is ObjectComponent)
                    {
                        AttachComponent(obj as ObjectComponent);
                    }
                    else
                    {
                        levelObjects.Add(obj);
                    }
                }
                else
                {
                    bool added = false;

                    if (obj is ILevelAsset)
                    {
                        obj = (from a in levelAssets
                               where a.ID == (obj as ILevelAsset).ID
                               select a).FirstOrDefault();

                        if (obj == null)
                        {
                            levelAssets.Add(obj as ILevelAsset);
                            added = true;
                        }
                    }

                    if (obj is PlayerStart && added)
                    {
                        if (playerStart == null)
                        {
                            playerStart = obj as PlayerStart;
                        }
                        else
                        {
                            new DuplicateError("Their is already a PlayerStart object in this Level. The object: "
                                               + (obj as PlayerStart).ID + " is invalid and will not be used.");
                        }
                    }

                    if (obj is IExit && added)
                    {
                        levelExits.Add(obj as IExit);
                    }

                    if (obj is IUpdate && added)
                    {
                        updateables.Add(obj as IUpdate);
                    }

                    if (obj is ObjectComponent)
                    {
                        AttachComponent(obj as ObjectComponent);
                    }
                }
            }

            foreach (ILevelAsset asset in levelAssets)
            {
                asset.LevelTransitionOn(levelName);
            }
        }
示例#24
0
    public void StartLevelTransitionIn(PlayerStart start)
    {
        if (start.LevelEntrance == LevelEntrance.Start || start.LevelEntrance == LevelEntrance.BeachRival)
        {
            transform.position = start.transform.position;
            return;
        }

        var tab = start.gameObject.GetComponentInChildren<TransitionTab>();
        transform.position = tab.WalkTarget.transform.position;
        transform.DOMove(tab.EnterTarget.transform.position, .5f).OnComplete(() =>
        {
            _control.Disabled = false;
        });
        
        // Pull info off the door or tab for what our animation should be
    }
示例#25
0
    // Use this for initialization
    void Start()
    {
        playerScript = GameObject.Find("Player").GetComponent <Player> ();
        playerStart  = GameObject.Find("PlayerNap").GetComponent <PlayerStart> ();

        xButton = GameObject.Find("x");

        xButton.SetActive(false);

        player   = GameObject.Find("Player").GetComponent <PlayerMovement> ();
        location = playerScript.GetComponent <Location> ();
        Combat   = GameObject.Find("Combat");

//
//		WinSound = GameObject.Find ("WinSound");
//
//		WinSound.SetActive (true);


        battleCanvas = GameObject.Find("BattleScreen");


        ItemDropImage = GameObject.Find("ItemDropImage");


        stats = GameObject.Find("Stats_Icon").GetComponent <Stats> ();


        ItemSlot1 = GameObject.Find("ItemSlot1").GetComponent <Image> ();

        napsackImage = GameObject.Find("NapsackImage");
        napsackImage.SetActive(true);

        napsackScript = Combat.GetComponent <Napsack> ();

        itemDictionary = GameObject.Find("NapsackStart").GetComponent <NapsackStart>().Inventory;


        bossName = Combat.GetComponent <BattleSystem> ().bossName;

        randObj = false;


        if (bossName == "Dream Keeper")
        {
        }
        else if (bossName == "Sleeping Girl")
        {
            if (playerScript.getSleepingGirlDefeated() == true)
            {
                ItemSlot1.sprite = GameObject.Find("Room Key").GetComponent <Image> ().sprite;

                napsackScript.testAdd("Room Key");

                playerScript.sethasKey(true);

                addToTXT("Room Key");
            }
        }
        else if (bossName == "Elliot")
        {
            if (playerScript.getMaajiDefeated() && playerScript.getElliotDefeated())
            {
                ItemSlot1.sprite = GameObject.Find("Recorder").GetComponent <Image> ().sprite;

                napsackScript.testAdd("Recorder");

                playerScript.sethasRecorder(true);

                addToTXT("Recorder");
            }
            else
            {
                randObj = true;
            }
        }
        else if (bossName == "Maaji")
        {
            if (playerScript.getMaajiDefeated() && playerScript.getElliotDefeated())
            {
                ItemSlot1.sprite = GameObject.Find("Recorder").GetComponent <Image> ().sprite;

                napsackScript.testAdd("Recorder");

                playerScript.sethasRecorder(true);

                addToTXT("Recorder");
            }
            else
            {
                randObj = true;
            }
        }
        else
        {
            randObj = true;
        }

        if (randObj == true)
        {
            string[] tempString = new string[12];

            int tempStringLocation = 0;


            foreach (KeyValuePair <string, int> keyValue in itemDictionary)
            {
                string key   = keyValue.Key;
                int    value = keyValue.Value;
                //value == 0 &&
                if (key != "Recorder" && key != "Room Key")
                {
                    tempString [tempStringLocation] = key;
                    tempStringLocation++;
                }
            }

            int randNum = Random.Range(0, tempStringLocation);

            print(tempString[randNum]);
            ItemSlot1.sprite = GameObject.Find(tempString [randNum]).GetComponent <Image>().sprite;

            napsackScript.testAdd(tempString [randNum]);

            addToTXT(tempString [randNum]);
        }
        Destroy(battleCanvas.GetComponent <BattleSystem> ());
    }