コード例 #1
0
    private void ResetGame()
    {
        level = 1;
        score = 0;
        lives = LIVES_MAX_NUM;

        UpdateLevel();
        UpdateScore();
        UpdateLives();

        if (!PlayerInstance)
        {
            PlayerInstance = Instantiate(PlayerPrefab, Model.PLAYERS_START_POS, Quaternion.identity, GameScreen.transform);
        }
        else
        {
            PlayerInstance.transform.position = Model.PLAYERS_START_POS;
        }

        if (!EnemiesControllerInstance)
        {
            EnemiesControllerInstance = Instantiate(EnemiesControllerPrefab, Vector2.zero, Quaternion.identity, GameScreen.transform);
            EnemiesControllerClass    = EnemiesControllerInstance.GetComponent <EnemiesController>();
        }
        else
        {
            EnemiesControllerClass.Reset();
        }

        SetGameState(GameState.MAIN);
    }
コード例 #2
0
ファイル: EnemiesController.cs プロジェクト: srnoel/Jam
 void Awake()
 {
     enemieC = this;
     Invoke("SummonFlyer", Random.Range(minFlyerTime, maxFlyerTime));
     Invoke("SummonCreeping", Random.Range(minCreepingTime, maxCreepingTime));
     Invoke("SummonWalker", Random.Range(minWalkerTime, maxWalkerTime));
 }
コード例 #3
0
 private void Start()
 {
     enemyParentComponent = GetComponent <Enemy>();
     sprRend     = GetComponent <SpriteRenderer>();
     enemiesCont = FindObjectOfType <EnemiesController>();
     DecideNextAttack();
 }
コード例 #4
0
    void Start()
    {
        // grab components
        //enemiesController = GameObject.Find("Enemies").GetComponent<EnemiesController>();
        enemiesController = transform.parent.GetComponent <EnemiesController>();
        waypoints         = enemiesController.GetWaypoinmts();
        //waypoints = GameObject.Find("Waypoints").GetComponent<Waypoints>();
        RB     = GetComponent <Rigidbody2D>();
        eSpeed = enemiesController.GetEnemySpeed();

        headingIndex      = 0;
        waypointThreshold = 5f;

        flightOrder = enemiesController.FlightOrder();

        if (flightOrder)
        {
            heading = waypoints.GetWaypoint(headingIndex).transform;
        }
        else
        {
            heading = waypoints.GetRNGWaypoint().transform;
        }
        NewDirection();
        //Spawn();
    }
コード例 #5
0
        static void Main(string[] args)
        {
            var thread = new Thread(new ThreadStart(() =>
            {
                RenderWindow window = new RenderWindow(new VideoMode(WINDOW_WIDTH, WINDOW_HEIGHT), "SFML Space Shooter");
                window.Closed      += Window_Closed;

                GameManager manager = new GameManager(window);

                PlayerController playerController   = new PlayerController();
                EnemiesController enemiesController = new EnemiesController();

                while (window.IsOpen)
                {
                    window.DispatchEvents();

                    window.Clear();
                    playerController.Update();

                    foreach (var item in GameManager.GameObjects.ToList())
                    {
                        item.Update();
                        UpdatePhysics(item);

                        item.Sprite.Position = item.Position;
                        item.Draw(window, RenderStates.Default);
                    }

                    window.Display();
                    Thread.Sleep(30);
                }
            }));

            thread.Start();
        }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        m_player = GetComponentInChildren <RigidbodyFirstPersonController> ( );
        GetComponentInChildren <ShootingController> ( ).Init(m_player.GetComponentInChildren <Camera> ( ).transform);

        m_enemiesController = GetComponentInChildren <EnemiesController> ( );
        m_enemiesController.Init(m_player.transform);
    }
コード例 #7
0
        void Awake()
        {
            _playerData = GetComponent <PlayerData>();
            _transform  = transform;

            _enemiesController = FindObjectOfType <EnemiesController>();
            AddWeapons();
            SubscribeOnEvents();
        }
コード例 #8
0
 public void Strike()
 {
     Collider2D[] enemies = Physics2D.OverlapCircleAll(_strikePoint.position, _strikeRange, _enemies);
     for (int i = 0; i < enemies.Length; i++)
     {
         EnemiesController enemy = enemies[i].GetComponent <EnemiesController>();
         enemy.TakeDamage(_damage);
     }
 }
コード例 #9
0
 //Start Method
 private void Start()
 {
     bombController      = this.GetComponent <BombController>();
     enemiesController   = this.GetComponent <EnemiesController>();
     timeController      = this.GetComponent <TimeController>();
     scoreController     = this.GetComponent <ScoreController>();
     sceneController     = this.GetComponent <SceneController>();
     extraEggsController = this.GetComponent <ExtraEggsController>();
     gamePauseController = this.GetComponent <GamePause>();
 }
コード例 #10
0
ファイル: NightCont.cs プロジェクト: Alain00/SunsetStalkers
 void Start()
 {
     enemiesController = EnemiesController.main;
     NightMulti        = PlayerPrefs.GetFloat("LvlCont");
     PlayerPrefs.SetFloat("LvlCont", NightMulti + .3f);
     NightDuration *= NightMulti + .3f;
     enemiesController.OnWaveBegins        += OnWaveBegins;
     enemiesController.OnWaveCompleted     += OnWaveEnd;
     enemiesController.OnLastWaveCompleted += EndLVL;
 }
コード例 #11
0
    private void Start()
    {
        GetNewSpawnTime();

        //Get enemies controller reference
        enemiesController = FindObjectOfType <EnemiesController>();
        enemiesController.SuscribeToEnemySpawner(this);
        //Get reference of all spawn points in the scene
        spawnPoints = FindObjectsOfType <SpawnPoints>();
    }
コード例 #12
0
    private void OnTriggerEnter2D(Collider2D info)
    {
        EnemiesController enemy = info.GetComponent <EnemiesController>();

        if (enemy != null)
        {
            enemy.TakeDamage(_damage);
        }
        Destroy(gameObject);
    }
コード例 #13
0
 // Start is called before the first frame update
 void Start()
 {
     enemiesCont   = FindObjectOfType <EnemiesController>();
     fakeEnemyThis = GetComponent <Enemy>();
     enemiesCont.OnEnemySpawnHandler(fakeEnemyThis);
     dTile = GetComponent <destructableTile>();
     dTile.OnDestroyTile += () =>
     {
         enemiesCont.OnEnemyDieHandler(fakeEnemyThis);
     };
 }
コード例 #14
0
ファイル: Brother.cs プロジェクト: Alain00/SunsetStalkers
 void Awake()
 {
     Store            = GameObject.Find("Shop");
     CloseText        = GameObject.Find("CloseText");
     ItemWindow       = GameObject.FindObjectOfType <StoreManager>().ItemWindow;
     Player           = GameObject.FindObjectOfType <PlayerController>();
     player           = GameObject.FindGameObjectWithTag("Player").transform;
     CameraController = GameObject.FindObjectOfType <FollowPlayer>();
     Store.SetActive(false);
     controller = EnemiesController.main;
 }
コード例 #15
0
            public void ReturnsEnemiesController()
            {
                // Arrange
                var db = Mock.Of <INecroDancerContext>();

                // Act
                var controller = new EnemiesController(db);

                // Assert
                Assert.IsAssignableFrom <EnemiesController>(controller);
            }
コード例 #16
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        EnemiesController enemy = collision.collider.GetComponent <EnemiesController>();

        if (enemy == null || _damageEnemies.Contains(enemy))
        {
            return;
        }
        enemy.TakeDamage(_powerStrikeDamage);
        _damageEnemies.Add(enemy);
    }
コード例 #17
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
 }
コード例 #18
0
 void Awake()
 {
     if (ec == null)
     {
         DontDestroyOnLoad(gameObject);
         ec = this;
     }
     else if (ec != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #19
0
ファイル: SpecialAttack.cs プロジェクト: PexoGameDev/EVX
 public static void RocketAttack(Soldier executor, EnemiesController controller, LivingEntity target)
 {
     //ProjectilesController.Instance.InitializeProjectile(new Projectile(dmg, executor.DamageType, executor.Position, executor, target,
     //    () =>
     //    {
     //        var collection =
     //            controller.Entities.Where(entity => entity.IsInRange(target.Position, ExplosionRange)).ToArray();
     //        for (var i = 0; i < collection.Length; i++)
     //        {
     //            collection[i].GetHit(new Projectile(dmg, executor.DamageType));
     //        }
     //    }));
 }
コード例 #20
0
ファイル: BlueEnemies.cs プロジェクト: vaelse/SpcShooter
    private void Start()
    {
        sr         = gameObject.GetComponent <SpriteRenderer>();
        WhiteMat   = Resources.Load("Assets/Materials/WhiteFlash", typeof(Material)) as Material;
        DefaultMat = sr.material;

        score     = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreController>();
        killcount = GameObject.Find("GameManager").GetComponent <GameManager>();

        audioManager = GameObject.FindGameObjectWithTag("audioManager").GetComponent <audiomanager>();

        blueEnemySpawner = GameObject.FindGameObjectWithTag("enemyspawn").GetComponent <EnemiesController>();
    }
コード例 #21
0
    public void Play()
    {
        if (costs.total > 100)
        {
            return;
        }
        gameObject.SetActive(false);
        GameObject     player = PlayerController.GetObject();
        CharacterState state  = player.GetComponent <CharacterState>();

        state.character = character;
        PlayerController.Activate();
        InputController.Activate();
        EnemiesController.CreateEnemy();
    }
コード例 #22
0
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        EnemiesController bullet = FindObjectOfType <EnemiesController>();

        //timerSpeeder += 0.1f*Time.deltaTime;
        speedSpeeder -= 2f * Time.deltaTime;


        if (timer >= 2f && bullet == null)
        {
            timer = 0;

            Instantiate(bulletPrefab);
        }
    }
コード例 #23
0
 void Awake()
 {
     if (main == null)
     {
         main = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (main == this)
     {
         return;
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #24
0
ファイル: ShipManager.cs プロジェクト: Alain00/SunsetStalkers
    void Start()
    {
        Vector3    point        = new Vector3(0, 50, 0) + transform.position;
        Vector3    brotherPoint = point + new Vector3(0, 0, -10);
        RaycastHit hit;

        if (Physics.Raycast(point, -transform.up, out hit))
        {
            transform.position = hit.point;
        }

        if (Physics.Raycast(brotherPoint, -transform.up, out hit))
        {
            brother.transform.position = hit.point;
        }

        controller = EnemiesController.main;
        controller.OnWaveBegins        += Leave;
        controller.OnWaveCompleted     += Arrive;
        controller.OnLastWaveCompleted += Arrive;
    }
コード例 #25
0
ファイル: MainGame.cs プロジェクト: vanyscore/ProjectPacman
        private void InititalizeGameObjects()
        {
            map = new Map(this, level);

            enemies = map.Enemies;
            gameEnd = false;

            pacman            = map.Pacman;
            pacManController  = new PacmanController(this, pacman);
            enemiesController = new EnemiesController(this, map);
            musicController   = new MusicController(this);

            enemiesController.PacmanWanted  += musicController.OnPacmanWanted;
            enemiesController.BonusEated    += musicController.OnPacmanPowerUp;
            enemiesController.GhostEated    += musicController.OnGhostEat;
            enemiesController.EnemyRestored += musicController.OnEnemyRestored;
            enemiesController.PacmanDie     += musicController.OnPacmanDie;

            pacManController.BallEated += musicController.OnBallEated;

            pacman.GameEnd += OnGameEnd;
        }
コード例 #26
0
        //private bool _canFire = true;

        private void Start()
        {
            _enemiesController = FindObjectOfType <EnemiesController>();
        }
コード例 #27
0
 public DisposeMethod()
 {
     controller = new EnemiesController(mockDb.Object);
 }
コード例 #28
0
        public EnemiesControllerTests(MockDatabaseFixture fixture)
        {
            var db = fixture.CreateNecroDancerContext();

            controller = new EnemiesController(db);
        }
コード例 #29
0
 private void Awake()
 {
     instance = this;
 }
コード例 #30
0
 public void Spawn(OnAllEnemiesDestroyedDelegate onAllEnemiesDestroyedDelegate)
 {
     _enemiesController = SpawnManager.Instance.CreateEnemiesController();
     _enemiesController.SetLastEnemyDeathDelegate(onAllEnemiesDestroyedDelegate);
     _enemiesController.enabled = false;
 }
コード例 #31
0
ファイル: SoldiersController.cs プロジェクト: PexoGameDev/EVX
 public SoldiersController(GameController gc, EnemiesController enemiesController, Sprite[] soldierSprites) : base(gc)
 {
     _ecoController     = gc.EconomyController;
     _enemiesController = enemiesController;
     _soldierSprites    = soldierSprites;
 }