void Start () { currentCamera = mng.cameraManager.currentCamera; mainCameraScript = currentCamera.GetComponent<MainCameraScript>(); shotManager = mng.shotManager; mng.eventManager.StartListening(EventManager.EventType.CAMERA_CHANGED, CameraChanged); }
public void StartLoad() { if (!isDummy) { if (IsClient) { GameManager.Singleton.InitLocalPlayer(OwnerClientId); //NetworkEvents.Singleton.RegisterEvent(NetworkEvent.GAME_START, this, OnGameStarted); GameManager.Singleton.GameStarted += OnGameStarted; m_shotmeter = GetComponent <ShotMeter>(); m_shotController = GetComponent <ShotController>(); } if (IsServer && !IsHost) { username = "******"; } else { m_rightHand = transform.Find("root/body/right arm/forearm/hand").gameObject; m_leftHand = transform.Find("root/body/left arm/forearm/hand").gameObject; m_center = transform.Find("Center").gameObject; m_animator = GetComponentInChildren <Animator>(); m_playerCircle = transform.Find("Player Circle").GetComponent <SpriteRenderer>(); } id = username.GetHashCode(); m_shotManager = GameObject.Find("GameManager").GetComponent <ShotManager>(); } }
Shot currentShot; // the current shot we are playing to acces it's attributes private void Start() { animator = GetComponent <Animator>(); // referennce out animator aimTargetInitialPosition = aimTarget.position; // initialise the aim position to the center( where we placed it in the editor ) shotManager = GetComponent <ShotManager>(); // accesing our shot manager component currentShot = shotManager.topSpin; // defaulting our current shot as topspin }
void Start() { targetPosition = transform.position; animator = GetComponent <Animator>(); aimTargetInitialPosition = aimTarget.position; shotManager = GetComponent <ShotManager>(); }
private void Start() { animator = GetComponent <Animator>(); aimTargetInitialPosition = aimTarget.position; shotManager = GetComponent <ShotManager>(); currentShot = shotManager.topSpin; }
ShotManager shotManager; // shot manager class/component void Start() { initialPos = transform.position; targetPosition = transform.position; // initialize the targetPosition to its initial position in the court animator = GetComponent <Animator>(); // reference to our animator for animations shotManager = GetComponent <ShotManager>(); // reference to our shot manager to acces shots }
void InitializeGame() { graphics.PreferredBackBufferWidth = 1000; graphics.PreferredBackBufferHeight = 700; graphics.ApplyChanges(); gameState = GameState.Playing; score = new ScoreManager(); this.Services.AddService(typeof(IScoreManager), score); console = new GameConsole(this); this.Components.Add(console); pool = new PoolManager(this); this.Components.Add(pool); pm = new PickUpManager(this); this.Components.Add(pm); player = new PlayerWGun(this); this.Components.Add(player); em = new EnemyManager(this, player); this.Components.Add(em); sm = new ShotManager(this); this.Components.Add(sm); hud = new HeadsUpDisplay(this, player); this.Components.Add(hud); }
void Awake() { highlightBox = transform.Find("chkHighlight").gameObject; playerRigid = GetComponent <Rigidbody>(); nowRot = transform.localRotation; playerCamera = GameObject.Find("Camera").GetComponent <Camera>(); cameraAni = playerCamera.GetComponent <Animator>(); playerAniCon = GetComponent <AnimationController>(); sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ItemCollectScene") { playerSpeed = 3; s_itemBtn = GameObject.Find("itemBtnCanvas/btn_GetItem").GetComponent <ItemBtn>(); canvas = GameObject.Find("Canvas"); Block = null; } else if (sceneName == "GameScene") { DontDestroyOnLoad(transform.parent); GM = GameObject.Find("GameMgr2/itemFieldCntrl").GetComponent <ItemFieldCntrl>(); sockServObj = GameObject.Find("GameMgr2/MatchingCntrl"); playerInfo = sockServObj.GetComponent <GameEnterScript>(); weaponNum = playerInfo.savCharInfo.weapon; spawnInfo = sockServObj.GetComponent <SpawnScript>(); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); shotMgr.point = GameObject.Find("PointPrefab"); shotMgr.point.SetActive(false); StartCoroutine(MoveDelay()); //플레이어의 정보 전송하는 코루틴 hpText = GameObject.Find("Canvas").transform.GetChild(0).GetComponent <Text>(); playerHPBar = GameObject.Find("Canvas").transform.GetChild(3).GetComponent <HpBar>(); Block = GameObject.Find("Canvas").transform.GetChild(4).gameObject; s_itemSpawn = GameObject.Find("itemSpawnArr").GetComponent <ItemSpawn>(); s_hitEffect = GameObject.Find("HitEffect").GetComponent <hitEffect>(); ChinkEffect = GameObject.Find("ChinkEffect"); ItemImg = new GameObject[4]; ItemImg[(int)eITEM.em_HP_POTION] = GameObject.Find("HpPotionImg").gameObject; ItemImg[(int)eITEM.em_SPEED_POTION] = GameObject.Find("SpdPotionImg").gameObject; ItemImg[(int)eITEM.em_DAMAGE_UP_POTIOM] = GameObject.Find("AtkPotionImg").gameObject; ItemImg[(int)eITEM.em_DEFENCE_UP_POTION] = GameObject.Find("DefPotionImg").gameObject; for (int i = 0; i < 4; i++) { ItemImg[i].SetActive(false); } sound = GameObject.Find("GameMgr").GetComponent <BgmController>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); } }
public Player(ShotManager shotManager) { // TODO: Complete member initialization this.shotManager = shotManager; sprint = 100; steps = 3; Draaipunt = new Vector2(18, 27); }
// Start is called before the first frame update void Start() { targetPosition = transform.position; animRival = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); shotManager = GetComponent <ShotManager>(); BallGO = GameObject.Find("Ball"); ballScript = BallGO.GetComponent <Ball>(); currentShot = shotManager.normal; initPosition = transform.position; }
Shot currentShot; // the current shot we are playing to acces it's attributes private void Start() { score = 0; initialPos = transform.position; n = 1; selfRigidbody = gameObject.GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); // referennce out animator aimTargetInitialPosition = aimTarget.position; // initialise the aim position to the center( where we placed it in the editor ) aimTarget2InitialPosition = aimTarget2.position; // initialise the aim position to the center( where we placed it in the editor ) shotManager = GetComponent <ShotManager>(); // accesing our shot manager component currentShot = shotManager.topSpin; // defaulting our current shot as topspin }
void Start() { playerAniCon = GetComponent <AnimationController>(); playerRigidBody = GetComponent <Rigidbody>(); custom = GetComponent <HeroCustomize>(); custom.IndexWeapon.CurrentType = weaponNum; playerAniCon.weaponIndex = weaponNum; animation = GetComponent <Animation>(); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); enemyAtk = enemyObj.GetComponent <AttackMgr>(); }
void Start() { DontDestroyOnLoad(transform.parent); playerAniCon = GetComponent <AnimationController>(); weaponType = GetComponent <HeroCustomize>().IndexWeapon.CurrentType; shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponType); hpText = GameObject.Find("Canvas").transform.GetChild(1).GetComponent <Text>(); enemyHpBar = transform.Find("Canvas").transform.GetChild(0).GetComponent <HpBar>(); s_itemSpawn2 = GameObject.Find("itemSpawnArr").GetComponent <itemSpawn2>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); }
public EnemyManager(Texture2D texture, Rectangle initialFrame, int frameCount, PlayerManager playerManager, Rectangle screenBounds) { this.texture = texture; this.initialFrame = initialFrame; this.frameCount = frameCount; this.playerManager = playerManager; EnemyShotManager = new ShotManager(texture, new Rectangle(0, 300, 5, 5), 4, 2, 150f, screenBounds); SetupWaypoints(); }
/// <summary> /// Awakes this instance. /// Asigna la variable estatica y el jugador /// </summary> private void Awake() { if (shm == null) { shm = this; } else if (shm != this) { Destroy(gameObject); } player = FindObjectOfType <Player>().transform; shotImage = FindObjectOfType <CurrentShotImage>(); }
// Use this for initialization void Start() { if (shotManager == null) { shotManager = this; } else if (shotManager != this) { Destroy(gameObject); } maxShots = 1; }
void Awake() { highlightBox = transform.Find("chkHighlight").gameObject; playerRigid = GetComponent <Rigidbody>(); nowRot = transform.localRotation; playerCamera = GameObject.Find("Camera").GetComponent <Camera>(); cameraAni = playerCamera.GetComponent <Animator>(); playerAniCon = GetComponent <AnimationController>(); sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ItemCollectScene") { playerSpeed = 3; s_itemBtn = GameObject.Find("itemBtnCanvas/btn_GetItem").GetComponent <ItemBtn>(); canvas = GameObject.Find("Canvas"); block = null; } else if (sceneName == "GameScene") { DontDestroyOnLoad(transform.parent); GM = GameObject.Find("GameMgr2/itemFieldCntrl").GetComponent <ItemFieldCntrl>(); sockServObj = GameObject.Find("GameMgr2/MatchingCntrl"); playerInfo = sockServObj.GetComponent <GameEnterScript>(); weaponNum = playerInfo.savCharInfo.weapon; spawnInfo = sockServObj.GetComponent <SpawnScript>(); usedItemEff = GameObject.Find("usedItemEff").GetComponent <Image>(); usedItemEff.gameObject.SetActive(false); Info = GameObject.Find("Info"); Info.transform.GetChild(weaponNum + 1).gameObject.SetActive(true); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); shotMgr.point = GameObject.Find("PointPrefab"); shotMgr.point.SetActive(false); StartCoroutine(MoveDelay()); //플레이어의 정보 전송하는 코루틴 playerHPBar = GameObject.Find("Canvas/playerHP").GetComponent <HpBar>(); block = GameObject.Find("Canvas/Block").gameObject; block.SetActive(false); s_itemSpawn = GameObject.Find("itemSpawnArr").GetComponent <ItemSpawn>(); s_hitEffect = GameObject.Find("HitEffect").GetComponent <hitEffect>(); ChinkEffect = GameObject.Find("ChinkEffect"); usedItemParticle = transform.Find("ItemEffect").GetComponentInChildren <ParticleSystem>(); usedItemParticleRender = transform.Find("ItemEffect").GetComponentInChildren <ParticleSystemRenderer>(); sound = GameObject.Find("GameMgr").GetComponent <BgmController>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); } }
public override void NetworkStart() { if (!IsServer) { return; } m_playerDistances = new Dictionary <ulong, float>(); m_shotManager = GameManager.Singleton.gameObject.GetComponent <ShotManager>(); m_ball = NetworkedObject.gameObject; m_body = gameObject.GetComponent <Rigidbody>(); m_body.AddForce(new Vector3(1, 1, 1), ForceMode.Impulse); }
void Start() { playerGO = GameObject.FindObjectOfType <Player>().gameObject; initialPlayerPosition = transform.position; animPlayer = GetComponent <Animator>(); ballGO = GameObject.FindObjectOfType <Ball>().gameObject; ballCollider = ballGO.GetComponent <SphereCollider>(); ballScript = ballGO.GetComponent <Ball>(); shotManager = GetComponent <ShotManager>(); currentShot = shotManager.normal; audioSource = GetComponent <AudioSource>(); gameControllerScript = TableGO.GetComponent <GameController>(); aimTargetSelected = Aimtargets[1].position; //default center }
void Awake() { if (shm == null) { shm = this; } else if (shm != this) { Destroy(gameObject); } player = FindObjectOfType <Player>().transform; shotImage = FindObjectOfType <CurrentShotImage>(); anim = player.GetComponent <Animator>(); }
public void Create() { GameTime = new Clock(); BZDatabase = new Database(); Cache = null; World = new GameWorld(); Flags = new FlagManager(); Players = new PlayerManager(); Chat = new ChatManager(); Shots = new ShotManager(); }
void Awake() { if (_instance == null) { //If i am the fist instance, make me the first Singleton _instance = this; } else { //If a Singleton already exists and you find another reference in scene, destroy it if (_instance != this) { Destroy(gameObject); } } }
public override void LoadContent(TextureManager textureManager) { Texture2D spriteSheet = textureManager.OptionalLoadContent <Texture2D>(@"Textures\SpriteSheet"); _tileMap.Intialise(spriteSheet); //_player = new Player( // spriteSheet, // new Rectangle(0, 64, 32, 32), 6, // new Rectangle(0, 96, 32, 32), 1, // new Vector2(300, 300), // _cam //); Rectangle playerBaseInitialRectangle = new Rectangle(0, 64, 32, 32); Rectangle playerTurretInitialRectangle = new Rectangle(0, 96, 32, 32); Vector2 playerLocation = new Vector2(300, 300); WorldSprite playerBase = new WorldSprite(spriteSheet, playerBaseInitialRectangle, _cam); WorldSprite playerTurret = new WorldSprite(spriteSheet, playerTurretInitialRectangle, _cam); playerBase.AddAnimation(6); _player = new Player(playerBase, playerTurret, _cam) { WorldLocation = playerLocation }; Rectangle particleRect = new Rectangle(0, 288, 2, 2); Rectangle explosionParticleRect = new Rectangle(0, 256, 32, 32); WorldTileSheet explosionTileSheet = new WorldTileSheet(spriteSheet, particleRect, _cam); WorldTileSheet particleTileSheet = new WorldTileSheet(spriteSheet, explosionParticleRect, _cam, 3); _effectsManager = new EffectsManager(explosionTileSheet, particleTileSheet); // Shots Rectangle shotRect = new Rectangle(0, 128, 32, 32); WorldTileSheet shotTileSheet = new WorldTileSheet(spriteSheet, shotRect, _cam, 2); ShotFactory shotFactory = new ShotFactory(shotTileSheet, _cam); _shotManager = new ShotManager(shotFactory); //_shotManager.OnShotDestroyed += OnShotDestroyed; _shotManager.OnShotCollision += OnShotCollision; _player.ShotFired += PlayerShotFired; }
public void Set(GameState state) { IsPublic = state.IsPublic; GameTime = state.GameTime; BZDatabase = state.BZDatabase; Cache = BZDatabase.Cache; World = state.World; Flags = state.Flags; Players = state.Players; Chat = state.Chat; Shots = state.Shots; ConfigData = state.ConfigData; }
// Use this for initialization void Start () { player = GetComponent<Player>(); mashBuffer = new char[mashBufferSize]; meleeBuffer = new char[mashBufferSize]; for(int i = 0; i < mashBufferSize; i++){ mashBuffer.SetValue('*', i); meleeBuffer.SetValue('D', i); } bufferIter = 0; exponentCooldown = 0; movementManager = gameObject.GetComponent<PlayerMovement>(); shotManager = gameObject.GetComponent<ShotManager>(); shotManager.SetMashBufferSize(mashBufferSize); startingColor = GetComponentInChildren<Renderer>().material.color; AudioSource[] sources = GetComponents<AudioSource>(); audioOne = sources[1]; audioTwo = sources[2]; }
public void StartGame() { _starField = new StarField(StarCount, _starVelocity, new TileSheet(_spriteSheet, _starTextureSourceRectangle, Star.AnimationFrames), ScreenBounds); _asteroidManager = new AsteroidManager(AsteroidCount, new TileSheet(_spriteSheet, _initalAsteroidFrame, Asteroid.AsteroidFrames), ScreenBounds); _shotManager = new ShotManager(new TileSheet(_spriteSheet, _shotTextureInitialFrame, Shot.AnimationFrames), ScreenBounds); _enemyManager = new EnemyManager(new TileSheet(_spriteSheet, _enemyInitialFrame, Enemy.AnimationFrames), ScreenBounds); _pieceExplosionManager = new ExplosionParticleSystem(new TileSheet(_spriteSheet, _explosionPieceSpriteFrame, ExplosionParticleSystem.PieceAnimationFrames), ExplosionParticleSystem.ParticleType.Piece); _pointExplosionManager = new ExplosionParticleSystem(new TileSheet(_spriteSheet, _explosionPointSpriteFrame, ExplosionParticleSystem.PointAnimationFrames), ExplosionParticleSystem.ParticleType.Point); _asteroidManager.OnAsteroidDestroy += (s, e) => _collisionEngine.RemoveEntity((GameEntity)s); _shotManager.OnShotDestroy += (s, e) => _collisionEngine.RemoveEntity((GameEntity)s); _enemyManager.OnEnemyDestroyed += HandleOnEnemyDestroy; _enemyManager.ShotFired += EnemyManagerShotFired; SpawnPlayer(); _playerScore = 0; _gameOver = false; }
public void StartGame() { gameState = GameState.Playing; SM = new ShotManager(this); this.Components.Add(SM); input = new InputHandler(this); this.Components.Add(input); spawner = new GhostSpawner(this); this.Components.Add(spawner); PS = new PlayerShoot(this); this.Components.Add(PS); score = new ScoreManager(this); this.Components.Add(score); }
public Client(ClientParams _params) { InTimedGame = false; TimeLeftInGame = -1; PlayerList.Clock = Clock; ShotMan = new ShotManager(PlayerList, Map); Params = _params; RegisterMessageHandlers(); InitDBCallbacks(); NetClient.TCPConnected += NetClient_TCPConnected; NetClient.MessageReceived += NetClient_HostMessageReceived; NetClient.HostIsNotBZFS += NetClient_HostIsNotBZFS; NetClient.Connect(Params.Host, Params.Port); }
public PlayerManager(Texture2D texture, Rectangle initialFrame, int frameCount, Rectangle screenBounds) { playerSprite = new Sprite(new Vector2(500, 500), texture, initialFrame, Vector2.Zero); PlayerShotManager = new ShotManager(texture, new Rectangle(0, 300, 5, 5), 4, 2, 250.0f, screenBounds); playerAreaLimit = new Rectangle(0, screenBounds.Height / 2, screenBounds.Width, screenBounds.Height / 2); for (int x = 1; x < frameCount; x++) { playerSprite.AddFrame(new Rectangle(initialFrame.X + (initialFrame.Width * x), initialFrame.Y, initialFrame.Width, initialFrame.Height)); } playerSprite.CollisionRadius = playerRadius; }
void Awake() { Singleton = this; GameState = GetComponent <BasketballStateManager>(); m_shotManager = GetComponent <ShotManager>(); baskets[0] = GameObject.Find("BasketLeft").GetComponent <Basket>(); baskets[0].id = 0; baskets[1] = GameObject.Find("BasketRight").GetComponent <Basket>(); baskets[1].id = 1; centerCourt = GameObject.Find("CenterCourt").transform.position; teams = new Team[2]; teams[0] = new Team((int)TeamType.HOME, teamSize); teams[1] = new Team((int)TeamType.AWAY, teamSize); inbounds = GameObject.FindGameObjectsWithTag("Inbound"); }
/// <summary> /// Update the state of the screen. /// </summary> /// <param name="gameTime">Current time of the game.</param> /// <param name="otherScreenHasFocus">true if other screen has the focus, false otherwise.</param> /// <param name="coveredByOtherScreen">true if other screen cover this screen, false otherwise.</param> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); if (!base.IsActive) { return; } LevelManager.GetLevel(_mapName).Update(gameTime); Vector3 playerPosition = _player.Position; _player.Update(gameTime); for (int i = 0; i < _enemies.Length; i++) { _enemies[i].Update(gameTime); if (_enemies[i].AttackMade) { _enemies[i].AttackMade = false; EventManager.Trigger(new EventData_CharactersAttack(_enemies[i], _player)); _enemiesAmount[i] = 0.0f; } else { _enemiesAmount[i] += gameTime.ElapsedGameTime.Milliseconds / 1000f; if (_enemiesAmount[i] >= 1.0f) { _enemiesAmount[i] = 0.0f; ((AnimatedModel)_player.DModel).Damaged = false; } } } ShotManager.Update(gameTime); _thrownObjectsManager.Update(gameTime); ((ChaseCamera)CameraManager.ActiveCamera).Move(_player, _player.Position - playerPosition); ((ChaseCamera)CameraManager.ActiveCamera).Update(gameTime); }
public Hinged(ContentManager content, Vector2 location, Player player) : base(content) { frameWidth = 40; frameHeight = 40; var texture = content.Load<Texture2D>(@"Textures\Sprites\ShipEnemies\Hinged"); animations.Add("idle", new AnimationStrip( texture, frameWidth, frameHeight, 0, 1, "idle")); animations["idle"].LoopAnimation = false; animations["idle"].FrameLength = 0f; animations.Add("open", new AnimationStrip( texture, frameWidth, frameHeight, 0, 4, "open")); animations["open"].LoopAnimation = false; animations["open"].FrameLength = 0.2f; animations.Add("die", new AnimationStrip( texture, frameWidth, frameHeight, 0, 1, 5, "die")); animations["die"].LoopAnimation = false; animations["die"].FrameLength = 0f; CollisionRectangle = new Rectangle(0,0,40,40); ignoresMapScroll = false; worldLocation = location; moveSpeed = 0f; velocity = Vector2.Zero; clampToScreen = false; clampToWorld = false; enabled = true; PlayAnimation("idle"); this.player = player; shotManager = new ShotManager(content.Load<Texture2D>(@"Textures\Sprites\Weapons\BasicRed"), 7, 475f, 0f); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here this.networkManager.Connect(); var randomNumberGenerator = new MersenneTwister(); this.inputManager = new InputManager(this, this.resolutionManager); this.soundManager = new SoundManager(randomNumberGenerator); this.shotManager = new ShotManager(this.resolutionManager, this.soundManager); this.shotManager.ShotFired += (sender, e) => this.networkManager.SendMessage(new ShotFiredMessage(e.Shot)); this.asteroidManager = new AsteroidManager(this.resolutionManager, randomNumberGenerator, this.IsHost); if (this.IsHost) { this.asteroidManager.AsteroidStateChanged += (sender, e) => this.networkManager.SendMessage(new UpdateAsteroidStateMessage(e.Asteroid)); } this.playerManager = new PlayerManager( this.resolutionManager, randomNumberGenerator, this.inputManager, this.shotManager, this.IsHost); this.playerManager.PlayerStateChanged += (sender, e) => this.networkManager.SendMessage(new UpdatePlayerStateMessage(e.Player)); this.enemyManager = new EnemyManager( randomNumberGenerator, this.shotManager, this.playerManager, this.IsHost); if (this.IsHost) { this.enemyManager.EnemySpawned += (sender, e) => this.networkManager.SendMessage(new EnemySpawnedMessage(e.Enemy)); } this.explosionManager = new ExplosionManager(this.soundManager, randomNumberGenerator); this.collisionManager = new CollisionManager(this.asteroidManager, this.playerManager, this.enemyManager, this.explosionManager, this.shotManager); this.Components.Add(this.inputManager); base.Initialize(); }
void Awake() { if(_instance == null) { //If i am the fist instance, make me the first Singleton _instance = this; } else { //If a Singleton already exists and you find another reference in scene, destroy it if(_instance != this) Destroy(gameObject); } }