Inheritance: NetworkBehaviour
	void Awake () {
		//Add all the necessary components
		LocationHandler locationHandler = gameObject.AddComponent<LocationHandler> ();
		locationHandler.Init ();

		//Set up displays
		m_displays = new Dictionary<string,DisplayHandler >();
		DisplayHandler[] displayChildren = gameObject.GetComponentsInChildren<DisplayHandler>();

		foreach (DisplayHandler display in displayChildren) {
			display.Init();
			display.HideDisplay();
			m_displays.Add(display.DisplayName,display);
		}

		m_dramaManager = new DramaManager (Screen.width,Screen.height);
		currGameState = m_dramaManager.GetRandomStartState ();

		//Start the display to start with
		if (m_displays.ContainsKey (displayToStartWith)) {
			m_currDisplay = displayToStartWith;
			m_displays[m_currDisplay].SwitchToDisplay();
		}
		else{
			Debug.LogError("GameplayManager Error: displayToStartWith did not match a Handler name"); 
		}

		Instance = this;
	}
 void Awake()
 {
     appManager = GetComponent<AppManager>();
     guiManager = GetComponent<GUIManager>();
     gameplayManager = GetComponent<GameplayManager>();
     soundManager = GetComponent<SoundManager>();
 }
 public FollowPath(GameplayManager gm, Unit owner, Path path, float lookAheadAmount = 20.0f)
     : base(gm, owner, path.GetPoint(0))
 {
     this.lookAheadAmount = lookAheadAmount;
     this.path = path;
     previousPathParam = 0.0f;
 }
    void Start()
    {
        rotationSpeed = Random.Range(-10.0f, 10.0f);
        gameplayManager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent<GameplayManager>();

        moveSpeed = Mathf.FloorToInt(gameplayManager.asteroidSpeed);
    }
 public BlendedChase(GameplayManager gm, Unit owner, Unit target)
     : base(gm, owner, new List<Tuple<SteeringBehaviour, float>> { 
         new Tuple<SteeringBehaviour,float>(new Chase(gm,owner,target),1.0f),
         new Tuple<SteeringBehaviour,float>(new Separate(gm,owner),0.5f),
         new Tuple<SteeringBehaviour,float>(new Clump(gm,owner),0.5f)
     })
 {
 }
    void Awake()
    {
        DontDestroyOnLoad(gameObject);

        inputManager = GetComponent<InputManager>();
        guiManager = GetComponent<GUIManager>();
        gameplayManager = GetComponent<GameplayManager>();
    }
 public BlendedFollowPath(GameplayManager gm, Unit owner, Path path)
     : base(gm, owner, new List<Tuple<SteeringBehaviour, float>> { 
         new Tuple<SteeringBehaviour,float>(new FollowPath(gm,owner,path),1.0f),
         new Tuple<SteeringBehaviour,float>(new Separate(gm,owner),0.8f),
         new Tuple<SteeringBehaviour,float>(new Clump(gm,owner),0.5f)
     })
 {
 }
Beispiel #8
0
 public UnitFSM(UnitController controller, GameplayManager gm)
 {
     StateIdle idleState = new StateIdle(controller,gm);
     AddState(idleState);
     AddState(new StateMove(controller,gm));
     AddState(new StateAttack(controller,gm));
     AddState(new StateAttackMove(controller,gm));
     AddState(new StateChase(controller,gm));
     AddState(new StateHoldPosition(controller,gm));
     defaultState = idleState;
     Reset();
 }
 public override void OnAwake()
 {
     base.OnAwake();
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Debug.LogError("Multiple gameplay managers");
         Destroy(gameObject);
     }
 }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     textComponent   = GetComponent <Text>();
     gameplayManager = GameplayManager.Instance;
 }
Beispiel #11
0
    private bool heartbeating  = false;                              //has the heartbeat started?


    // ----------------------- FUNCTIONS ----------------------------------
    void Start()
    {
        gmScript = this.gameObject.GetComponent <GameplayManager>(); //find gamemanager script so you can access it.
    }
 public PaddleSpeedUp(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.PaddleSpeedUp)
 {
 }
Beispiel #13
0
 public GameplayState(GameplayManager owner , double stateStart)
  {
      m_Owner = owner;
      m_StateStartTime = stateStart;
  }
 private static void Postfix()
 {
     if (!PilotSave.OtherDetected() && (GameplayManager.IsChallengeMode && GameplayManager.m_level_info.Mission.FileName != "_EDITOR" && ChallengeManager.ChallengeRobotsDestroyed > 0))
     {
         try {
             Scores.UpdateChallengeScore(GameplayManager.m_level_info.LevelNum, GameplayManager.DifficultyLevel, ChallengeManager.CountdownMode, PilotManager.PilotName, ChallengeManager.ChallengeScore, ChallengeManager.ChallengeRobotsDestroyed, GameplayManager.MostDamagingWeapon(), GameplayManager.AliveTime);
         }
         catch (Exception ex) {
             uConsole.Log(ex.Message);
         }
     }
 }
 public StandStill(GameplayManager gm, Unit owner)
     : base(gm, owner)
 {
 }
Beispiel #16
0
 private void Start()
 {
     m_gameplayManager = GetComponentInParent <GameplayManager>();
 }
Beispiel #17
0
 protected override void Awake()
 {
     base.Awake();
     gameplayManager = GetComponent <GameplayManager>();
 }
Beispiel #18
0
 public GameplayState(GameplayManager manager)
 {
     gameplayManager = manager;
 }
    void Awake()
    {
        m = this;

        StartGame();
    }
Beispiel #20
0
 private void setAvailableCount()
 {
     availableCount.text = GameplayManager.GetAvailablePowerups(type).ToString();
 }
Beispiel #21
0
 private void Awake()
 {
     _self      = this;
     levelIndex = scene - Scene.LEVEL_1;
 }
Beispiel #22
0
 private void Start()
 {
     GameplayManager.OnSpawnCreated();
 }
    private void Start()
    {
        GameObject gameManagerObject = GameObject.Find("GameManager");

        gameManager = gameManagerObject.GetComponent <GameplayManager>();
    }
Beispiel #24
0
        public GameplayState_countdown(GameplayManager owner, double starttime) : base(owner, starttime)
        {

        }
 //float previousPathParam = 0;
 //float lookAheadAmount = 20.0f;
 public StateAttackMove(UnitController controller, GameplayManager gm)
     : base(FSMStates.AttackMove, controller,gm)
 {
 }
 void Awake()
 {
     Instance = this;
 }
 // Use this for initialization
 void Start()
 {
     gameplayManager = FindObjectOfType <GameplayManager> ();
     enemySpawner    = FindObjectOfType <EnemySpawner> ();
 }
 void Awake()
 {
     // Register this script as the singleton instance.
     Instance = this;
 }
 public PowerPlant(GameplayManager gm, int gridX, int gridY, int faction, World world, Grid grid)
     : base(gm, gridX, gridY, faction, world, 1, 1, 300, 100.0f, 100, grid)
 {
     powerSource = (ResourceTile)grid.GetTile(gridX, gridY);
 }
 public SteeringBehaviour(GameplayManager gm, Unit owner)
 {
     this.gm = gm;
     this.owner = owner;
 }
Beispiel #31
0
	public int ownerPlayerID; //NetworkManager.GetPlayerIndex(spaceshipMesh.networkView.owner.ipAddress);
	
	
	void Start () {
		gameplayManager = GameplayManager.instance;
	}
Beispiel #32
0
 void Awake()
 {
     playerNumber = -1;
     gpManager = GameObject.Find("GameplayManager").GetComponent<GameplayManager>();
     field = GetComponent<PlayingField>();
     hand = new List<GameObject>();
     vAxisInUse = false;
     hAxisInUse = false;
     showInfoFlag = true;
     selectionIndex = 0;
     selectionItems = new List<GameObject>();
 }
Beispiel #33
0
    // Calculate Mutate Chance [TESTED]
    private bool CalculateMutationChance()
    {
        int random = UnityEngine.Random.Range(0, 100);

        return((float)random / 100.0f < GameplayManager.GetInstance().PercentageChildMutationChance);
    }
Beispiel #34
0
    public int lives;                                           // The player's lives.

    void Awake()
    {
        // Register this script as the singleton instance.
        Instance = this;
    }
Beispiel #35
0
    // Generation End
    private void GenerationEnd()
    {
        // Update Values
        UpdateChildrenCount();
        UpdateBreedingAmount();

        _Generation++;

        // Order all epochs based on score
        _Epoch_All = ReorderCurrentEpochsByScore();

        // Take Best Epoch
        if (_Epoch_All[_MaxEpochs - 1].GetScore() > _Best.GetScore())
        {
            _Best.CopyData(_Epoch_All[_MaxEpochs - 1]);
            _Best.SetScore(_Epoch_All[_MaxEpochs - 1].GetScore());
        }

        // New Children
        Epoch[] NewChildren = new Epoch[NewChildrenCount];

        // Create Children Values
        for (int i = 0; i < NewChildrenCount; i++)
        {
            // Acquire Random Amount of Epochs
            List <Epoch> Randos = AcquireRandomEpochs(BreedingAmount);
            // Find best 2 epochs
            Epoch Best_1 = FindBestEpochByScore(Randos);
            Epoch Best_2 = FindBestEpochByScore(Randos, Best_1);
            // Child Value
            NewChildren[i] = Epoch.CrossOver(Best_1, Best_2);
            //  Debug.Log("Best1 Bias: " + Best_1.GetOutputLayers()[0].GetBias());
            //  Debug.Log("Best2 Bias: " + Best_2.GetOutputLayers()[0].GetBias());
            //  Debug.Log("Child Bias: " + NewChildren[i].GetOutputLayers()[0].GetBias());
            //  Debug.Log("~~~");

            // Chance that child mutates
            if (CalculateMutationChance())
            {
                NewChildren[i].MutateValues(GameplayManager.GetInstance().MutationAmount);
            }
        }

        // Replace weakest ones with children
        for (int i = 0; i < NewChildrenCount; i++)
        {
            _Epoch_All[i].CopyData(NewChildren[i]);
        }

        // Add best epoch back in the list
        _Epoch_All[NewChildrenCount].CopyData(_Best);

        // Weakest one right after children getss jittered a lot for fun
        if (GameplayManager.GetInstance().MutateOneWeakestByALot)
        {
            _Epoch_All[NewChildrenCount].MutateValues(GameplayManager.GetInstance().MutationAmount * 2.0f);
        }

        // Reset all scores
        ResetScores();

        // Start Next Epoch
        NextEpoch();


        //  // Find best 2 Epochs
        //  Epoch Winner_1st = FindBestEpochByScore();
        //  Epoch Winner_2nd = FindBestEpochByScore(Winner_1st);
        //  Epoch Child = Epoch.CrossOver(Winner_1st, Winner_2nd);
        //
        //  // Error Check
        //  if(Child == null)
        //  {
        //      Debug.LogError("CrossoverChild Error");
        //      NextEpoch();
        //      return;
        //  }
        //
        //  // Set first two epochs as winner and child
        //  _Epoch_All[0] = Winner_1st;
        //  _Epoch_All[1] = Child;
        //
        //  // Rest of epochs are just clones of child with jitter
        //  for (int i = 2; i < _MaxEpochs; i++)
        //  {
        //      _Epoch_All[i].CopyLayers(Child);
        //      _Epoch_All[i].JitterLayers(GameplayManager.GetInstance().MutationAmount);
        //  }
    }
Beispiel #36
0
 void Awake()
 {
     gameplayManager = GameObject.FindObjectOfType <GameplayManager> ();
 }
 public SplitBalls(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.SplitBalls)
 {
 }
Beispiel #38
0
 /// <summary>
 /// Start the spawning coroutine.
 /// </summary>
 public void Spawn()
 {
     GameplayManager.OnSpawnActivated();
     StartCoroutine(OnSpawn());
 }
 // Use this for initialization
 void Start()
 {
   Instance = this;
 }
 void Awake()
 {
     instance = this;
 }
 public StickyPaddle(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.StickyPaddle)
 {
 }
Beispiel #42
0
 void Start()
 {
     gameplayManager = FindObjectOfType <GameplayManager>();
 }
 public StateHoldPosition(UnitController controller, GameplayManager gm)
     : base(FSMStates.HoldPosition, controller, gm)
 {
 }
 public static bool UseNonFixedHoming(Projectile proj)
 {
     return((proj.m_type == ProjPrefab.missile_hunter || proj.m_type == ProjPrefab.missile_pod || proj.m_type == ProjPrefab.missile_smart_mini || proj.m_type == ProjPrefab.missile_creeper || proj.m_type == ProjPrefab.missile_timebomb) &&
            !GameplayManager.IsDedicatedServer() && GameplayManager.IsMultiplayer && MenuManager.m_mp_lan_match);
 }
 public TemporaryGun(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.TemporaryGun)
 {
 }
Beispiel #46
0
    void Awake()
    {
        Instance = this;
        m_allEntities = new List<Entity>();
        m_activeEnemies = new List<Enemy>();
        m_activeNPCs = new List<NPC>();
        m_player = null;
        m_spawners = new List<EnemySpawner>(FindObjectsOfType<EnemySpawner>());

        m_gameOver = GameOverType.None;
        m_gameOverScreen = FindObjectOfType<GameOver>();
        if (m_gameOverScreen != null)
        {
            m_gameOverScreen.gameObject.SetActive(false);
        }

        m_killedCreatureCount = m_killedNPCCount = 0;
        m_spawnedCreatures = m_spawnedNPCCount = 0;
        m_elapsed = 0.0f;

        m_boundaries = new Rect();
        Camera cam = Camera.main;
        float camHHeight = cam.orthographicSize;
        float camHWidth = camHHeight * cam.aspect;
        cam.transform.position.Set(0,0,cam.transform.position.z);
        m_boundaries.x = -camHWidth;
        m_boundaries.width = camHWidth * 2;
        m_boundaries.y = 2 * camHHeight;
        m_boundaries.height = camHHeight * 4; // At the moment there are two areas on top of each other
    }
Beispiel #47
0
 public void execute()
 {
     GameplayManager.getManager().SendMessage(function);
 }
Beispiel #48
0
 public GameplayState_battle(GameplayManager owner, double starttime) : base(owner, starttime)
 {
     
 }
Beispiel #49
0
 public void Init(GameplayManager gameplayMgrRef)
 {
     gameplayMgr = gameplayMgrRef;
     name        = gameplayMgr.korokkePrefab.name;
     transform.SetParent(gameplayMgr.sceneRoot);
 }
        public PaddleSizeUp(GameplayManager gm, World world, Vector2 position)
            : base(gm, world, position, PowerUpType.PaddleSizeUp)
        {

        }
Beispiel #51
0
 public void Cleanup()
 {
     //spriteRendererRef = null;
     gameplayMgr = null;
 }
Beispiel #52
0
 public Arrive(GameplayManager gm, Unit owner, Vector2 position, float tolerance = 5.0f)
     : base(gm, owner)
 {
     this.position = position;
     this.tolerance = tolerance;
 }
Beispiel #53
0
 public void Inject(GameplayManager gameplayManager)
 {
     input           = gameplayManager.input;
     dialogFrameText = gameplayManager.tutorialUI.dialogFrameText;
 }
 public BallSizeDown(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.BallSizeDown)
 {
 }
Beispiel #55
0
 // Set gameplay manager
 void Awake()
 {
     manager = GameObject.FindWithTag("GameplayManager").GetComponent <GameplayManager> ();
 }
 public ExtraLife(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.ExtraLife)
 {
 }
 public BattleContoller(GameplayManager gamePlayManager)
     : base()
 {
     _gamePlayManager = gamePlayManager;
     ReviveCount      = 0;
 }
 public PaddleSpeedDown(GameplayManager gm, World world, Vector2 position)
     : base(gm, world, position, PowerUpType.PaddleSpeedDown)
 {
     
 }
        private void OnSceneLoaded(Scene newScene, LoadSceneMode mode)
        {
            var gameStatus = statusManager.gameStatus;

            gameStatus.scene = newScene.name;

            if (newScene.name == "Menu")
            {
                // Menu
                headInObstacle = false;

                // TODO: get the current song, mode and mods while in menu
                gameStatus.ResetMapInfo();

                gameStatus.ResetPerformance();

                statusManager.EmitStatusUpdate(ChangedProperties.AllButNoteCut, "menu");
            }
            else if (newScene.name == "StandardLevel")
            {
                // In game
                mainSetupData = Resources.FindObjectsOfTypeAll <MainGameSceneSetupData>().FirstOrDefault();
                if (mainSetupData == null)
                {
                    Console.WriteLine("[HTTP Status] Couldn't find MainGameSceneSetupData");
                    return;
                }

                gamePauseManager = Resources.FindObjectsOfTypeAll <GamePauseManager>().FirstOrDefault();
                if (gamePauseManager == null)
                {
                    Console.WriteLine("[HTTP Status] Couldn't find GamePauseManager");
                    return;
                }

                scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault();
                if (scoreController == null)
                {
                    Console.WriteLine("[HTTP Status] Couldn't find ScoreController");
                    return;
                }

                gameplayManager = Resources.FindObjectsOfTypeAll <GameplayManager>().FirstOrDefault();
                if (gameplayManager == null)
                {
                    Console.WriteLine("[HTTP Status] Couldn't find GameplayManager");
                    return;
                }

                beatmapObjectCallbackController = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>().FirstOrDefault();
                if (beatmapObjectCallbackController == null)
                {
                    Console.WriteLine("[HTTP Status] Couldn't find BeatmapObjectCallbackController");
                    return;
                }

                GameSongController gameSongController = (GameSongController)gameSongControllerField.GetValue(gameplayManager);
                audioTimeSyncController          = (AudioTimeSyncController)audioTimeSyncControllerField.GetValue(gameSongController);
                playerHeadAndObstacleInteraction = (PlayerHeadAndObstacleInteraction)playerHeadAndObstacleInteractionField.GetValue(scoreController);

                // Register event listeners
                // private GameEvent GamePauseManager#_gameDidPauseSignal
                AddSubscriber(gamePauseManager, "_gameDidPauseSignal", OnGamePause);
                // private GameEvent GamePauseManager#_gameDidResumeSignal
                AddSubscriber(gamePauseManager, "_gameDidResumeSignal", OnGameResume);
                // public ScoreController#noteWasCutEvent<NoteData, NoteCutInfo, int multiplier> // called after AfterCutScoreBuffer is created
                scoreController.noteWasCutEvent += OnNoteWasCut;
                // public ScoreController#noteWasMissedEvent<NoteData, int multiplier>
                scoreController.noteWasMissedEvent += OnNoteWasMissed;
                // public ScoreController#scoreDidChangeEvent<int> // score
                scoreController.scoreDidChangeEvent += OnScoreDidChange;
                // public ScoreController#comboDidChangeEvent<int> // combo
                scoreController.comboDidChangeEvent += OnComboDidChange;
                // public ScoreController#multiplierDidChangeEvent<int, float> // multiplier, progress [0..1]
                scoreController.multiplierDidChangeEvent += OnMultiplierDidChange;
                // private GameEvent GameplayManager#_levelFinishedSignal
                AddSubscriber(gameplayManager, "_levelFinishedSignal", OnLevelFinished);
                // private GameEvent GameplayManager#_levelFailedSignal
                AddSubscriber(gameplayManager, "_levelFailedSignal", OnLevelFailed);
                // public event Action<BeatmapEventData> BeatmapObjectCallbackController#beatmapEventDidTriggerEvent
                beatmapObjectCallbackController.beatmapEventDidTriggerEvent += OnBeatmapEventDidTrigger;

                var diff  = mainSetupData.difficultyLevel;
                var level = diff.level;

                gameStatus.mode = mainSetupData.gameplayMode.ToString();

                gameStatus.songName       = level.songName;
                gameStatus.songSubName    = level.songSubName;
                gameStatus.songAuthorName = level.songAuthorName;
                gameStatus.songBPM        = level.beatsPerMinute;
                gameStatus.songTimeOffset = (long)(level.songTimeOffset * 1000f);
                gameStatus.length         = (long)(level.audioClip.length * 1000f);
                gameStatus.start          = GetCurrentTime();
                gameStatus.paused         = 0;
                gameStatus.difficulty     = diff.difficulty.Name();
                gameStatus.notesCount     = diff.beatmapData.notesCount;
                gameStatus.obstaclesCount = diff.beatmapData.obstaclesCount;
                gameStatus.maxScore       = ScoreController.MaxScoreForNumberOfNotes(diff.beatmapData.notesCount);

                try {
                    // From https://support.unity3d.com/hc/en-us/articles/206486626-How-can-I-get-pixels-from-unreadable-textures-
                    var texture   = level.coverImage.texture;
                    var active    = RenderTexture.active;
                    var temporary = RenderTexture.GetTemporary(
                        texture.width,
                        texture.height,
                        0,
                        RenderTextureFormat.Default,
                        RenderTextureReadWrite.Linear
                        );

                    Graphics.Blit(texture, temporary);
                    RenderTexture.active = temporary;

                    var cover = new Texture2D(texture.width, texture.height);
                    cover.ReadPixels(new Rect(0, 0, temporary.width, temporary.height), 0, 0);
                    cover.Apply();

                    RenderTexture.active = active;
                    RenderTexture.ReleaseTemporary(temporary);

                    gameStatus.songCover = System.Convert.ToBase64String(
                        ImageConversion.EncodeToPNG(cover)
                        );
                } catch {
                    gameStatus.songCover = null;
                }

                gameStatus.ResetPerformance();

                // TODO: obstaclesOption can be All, FullHeightOnly or None. Reflect that?
                gameStatus.modObstacles = mainSetupData.gameplayOptions.obstaclesOption.ToString();
                gameStatus.modNoEnergy  = mainSetupData.gameplayOptions.noEnergy;
                gameStatus.modMirror    = mainSetupData.gameplayOptions.mirror;

                statusManager.EmitStatusUpdate(ChangedProperties.AllButNoteCut, "songStart");
            }
            else
            {
                statusManager.EmitStatusUpdate(ChangedProperties.AllButNoteCut, "scene");
            }
        }