void Start()
	{
		projectile		= GetComponent<ProjectileManager>();
		weapon			= GetComponentInChildren<Weapon>();
		target			= GameObject.Find(PLAYER).transform;
		attackInterval = Rand.Range(1.5f, 2.5f);
	}
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     m_playerManager = GetComponent<PlayerManager>();
     m_projectileManager = GetComponent<ProjectileManager>();
     m_shipManager = GetComponent<ShipManager>();
     m_spawner = GetComponent<Spawner>();
     kills = 0;
     timeGameEnded = 0.0f;
 }
Exemple #3
0
    // Use this for initialization
    public void Start()
    {
        m_projectileManager = GetComponentInParent<ProjectileManager> ();
        m_spawnedShips = new GameObject ();
        m_spawnedShips.name = "SpawnedShips";

        m_playerManager = GetComponent<PlayerManager>();
        m_Game = GetComponent<Game>();
    }
Exemple #4
0
 // called my manager
 public void initialize(ProjectileManager manager, PType type) {
     mesh = transform.Find("Model").gameObject;
     col = GetComponent<Collider>();
     rb = GetComponent<Rigidbody>();
     psem = transform.Find("Particles").GetComponent<ParticleSystem>().emission;
     lightComp = GetComponent<Light>();
     this.manager = manager;
     this.type = type;
     freeze = false;
     reset();
 }
Exemple #5
0
    void Awake()
    {
        _instance = this;

        // Keep object alive between scenes.
        //DontDestroyOnLoad (gameObject);

        // If there is more than 1 of this object, destroy the second instance.
        if (!firstInstance && FindObjectsOfType (typeof(GameData)).Length > 1) {
            DestroyImmediate (gameObject);
        } else {
            firstInstance = true;
        }
    }
Exemple #6
0
    // Use this for initialization
    void Start() {
        ui = GameObject.Find("StatUI").GetComponent<StatUI>();
        spawner = GameObject.Find("SpawnManager").GetComponent<SpawnManager>();
        shooter = GameObject.Find("ProjectileManager").GetComponent<ProjectileManager>();
        player = GameObject.Find("Player").GetComponent<Player>();
        frontInd = transform.Find("LevelIndicator").GetComponent<Text>();
        backInd = transform.Find("LevelIndicatorBack").GetComponent<Text>();
        overlay = transform.Find("Overlay").gameObject;
        fadeImage = overlay.GetComponent<RawImage>();

        player.reset();

        StartCoroutine(startSequence());
    }
        public World(Game1 containingGame, int w, int h)
        {
            game = containingGame;
            Player1 = new Player(this);
            random = new Random();
            Projectiles = new ProjectileManager(this);
            WorldWidth = w;
            WorldHeight = h;

            explosions = new List<Animation>();

            enemies = new List<Enemy>();
            previousSpawnTime = TimeSpan.Zero;
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);
            projectile = false;

            powerUps = new List<PowerUp>();

            bossActive = false;
        }
        protected override void Initialize()
        {
            theFileManager = FileManager.Get(this);
            theInputManager = InputManager.Get(this);
            theUtilityManager = UtilityManager.Get(this);
            theTileManager = TileManager.Get(this);
            theButtonManager = ButtonManager.Get(this);
            thePlayerManager = PlayerManager.Get(this);
            theScreenManager = ScreenManager.Get(this);
            theCameraManager = CameraManager.Get(this);
            theEnemyManager = EnemyManager.Get(this);
            theProjectileManager = ProjectileManager.Get(this);
            theCollisionManager = CollisionManager.Get(this);

            theScreenManager.WorldScreen = new MainMenu();

            Player.CreatePlayer("test", new Vector2(mScreenDimensions.X / 2.0f, mScreenDimensions.Y / 2.0f), Vector2.Zero);

            TileButton.Create(new FloorCopper(), Keys.E);
            TileButton.Create(new FloorMetal(), Keys.R);
            TileButton.Create(new HardWallCopper(), Keys.T);
            TileButton.Create(new HardWallMetal(), Keys.Y);
            TileButton.Create(new WallMetal(), Keys.Q);
            TileButton.Create(new CopperWall(), Keys.W);

            EnemyButton.Create(new EnemyTurret(), Keys.F);
             //   EnemyButton.Create("Turret_Gun", Keys.F);

            theTileManager.Load("Level_1.xml");

            base.Initialize();
        }
Exemple #9
0
    public void init()
    {
        // deprecated variables warnings:
        if (jumpForce != 0 && jumpHeight == 0) {
            Debug.LogError("PlayerController.jumpForce is deprecated. Use jumpHeight instead.");
            jumpHeight = jumpForce;
        }
        if (jumpDownwardForce != 0 && gravity == 0) {
            Debug.LogError("PlayerController.jumpDownwardForce is deprecated. Use gravity instead.");
            gravity = jumpDownwardForce;
        }
        // rigidbody should no longer use gravity, be kinematic, and freeze all constraints
        if (rigidbody != null) {
            if (rigidbody.useGravity) {
                Debug.LogError("The rigidbody no longer needs to use gravity. Disabling.");
                rigidbody.useGravity = false;
            }
            if (!rigidbody.isKinematic) {
                Debug.LogError("The rigidbody should be kinematic. Enabling.");
                rigidbody.isKinematic = true;
            }
            if (rigidbody.constraints != RigidbodyConstraints.FreezeAll) {
                Debug.LogError("The rigidbody should freeze all constraints. The PlayerController will take care of the physics.");
                rigidbody.constraints = RigidbodyConstraints.FreezeAll;
            }
        }

        cameraController = CameraController.instance;
        infiniteObjectGenerator = InfiniteObjectGenerator.instance;
        powerUpManager = PowerUpManager.instance;
        gameManager = GameManager.instance;
        if (attackType == AttackType.Projectile) {
            projectileManager = GetComponent<ProjectileManager>();
        }

        platformLayer = 1 << LayerMask.NameToLayer("Platform");
        floorLayer = 1 << LayerMask.NameToLayer("Floor");
        wallLayer = LayerMask.NameToLayer("Wall");
        obstacleLayer = LayerMask.NameToLayer("Obstacle");

        thisTransform = transform;
        capsuleCollider = GetComponent<CapsuleCollider>();
        playerAnimation = GetComponent<PlayerAnimation>();
        playerAnimation.init();

        startPosition = thisTransform.position;
        startRotation = thisTransform.rotation;

        slideData = new CoroutineData();
        stumbleData = new CoroutineData();
        forwardSpeeds.init();
        // determine the fastest and the slowest forward speeds
        forwardSpeeds.getMinMaxValue(out minForwardSpeed, out maxForwardSpeed);
        forwardSpeedDelta = maxForwardSpeed - minForwardSpeed;
        if (forwardSpeedDelta == 0) {
            playerAnimation.setRunSpeed(1, 1);
        }

        // make sure the coin magnet trigger is deactivated
        activatePowerUp(PowerUpTypes.CoinMagnet, false);

        reset();
        enabled = false;
    }
Exemple #10
0
 void Awake()
 {
     main = this;
 }
 public void Awake()
 {
     instance = this;
     totalProjectileCount = 0;
     projectileObjManager = new ProjectileObjManager();
 }
Exemple #12
0
    // Use this for initialization
    public override void Start()
    {
        Instance = this;

        base.Start();
    }
Exemple #13
0
 new void Start()
 {
     _projectileManager = GameObject.Find("ProjectileManager").GetComponent<ProjectileManager>();
     base.Start();
 }
Exemple #14
0
 // Use this for initialization
 void Start()
 {
     player  = GameObject.Find("Player").transform;
     projMan = GameObject.Find("ProjectileManager").GetComponent <ProjectileManager>();
     ebs     = GetComponent <EnemyBasicScript>();
 }
Exemple #15
0
 void Start()
 {
     _projectileManager  = GameObject.Find("ProjectileManager").GetComponent <ProjectileManager>();
     _healthBar.maxValue = _maxHealth;
     _healthBar.value    = _maxHealth;
 }
 /// <summary>
 /// Initialize any components required by this state.
 /// </summary>
 public override void Initialize()
 {
     ServiceManager.Game.FormManager.ClearWindow();
     Options options = ServiceManager.Game.Options;
     RendererAssetPool.DrawShadows = GraphicOptions.ShadowMaps;
     mouseCursor = new MouseCursor(options.KeySettings.Pointer);
     mouseCursor.EnableCustomCursor();
     renderer = ServiceManager.Game.Renderer;
     fps = new FrameCounter();
     Chat = new ChatArea();
     Projectiles = new ProjectileManager();
     Tiles = new TexturedTileGroupManager();
     Utilities = new UtilityManager();
     cd = new Countdown();
     Lazers = new LazerBeamManager(this);
     Scene.Add(Lazers, 0);
     Players = new PlayerManager();
     currentGameMode = ServiceManager.Theater.GetCurrentGameMode();
     Flags = new FlagManager();
     Bases = new BaseManager();
     EnvironmentEffects = new EnvironmentEffectManager();
     buffbar = new BuffBar();
     Scores = new ScoreBoard(currentGameMode, Players);
     input = new ChatInput(new Vector2(5, ServiceManager.Game.GraphicsDevice.Viewport.Height), 300);//300 is a magic number...Create a chat width variable.
     input.Visible = false;
     hud = HUD.GetHudForPlayer(Players.GetLocalPlayer());
     localPlayer = Players.GetLocalPlayer();
     Scene.MainEntity = localPlayer;
     sky = ServiceManager.Resources.GetTexture2D("textures\\misc\\background\\sky");
     tips = new GameTips(new GameContext(CurrentGameMode, localPlayer));
     helpOverlay = new HelpOverlay();
 }
 // Use this for initialization
 void Start() {
     player = GameObject.Find("Player").transform;
     projMan = GameObject.Find("ProjectileManager").GetComponent<ProjectileManager>();
     ebs = GetComponent<EnemyBasicScript>();
 }
Exemple #18
0
    /*** Script Methods ***/
    // Use this for initialization
    void Start()
    {
        /*** Init. Game System ***/

        // Default camera zoom
        Camera.main.orthographicSize = Globals.MinCameraSize + (Globals.MaxCameraSize - Globals.MinCameraSize) / 2.0f;

        // Instantiate all game-level objects
        SManager = gameObject.AddComponent(typeof(SpriteManager)) as SpriteManager;
        ProjManager = gameObject.AddComponent(typeof(ProjectileManager)) as ProjectileManager;
        ShipManager = gameObject.AddComponent(typeof(ShipsManager)) as ShipsManager;
        SceneManager = gameObject.AddComponent(typeof(SceneryManager)) as SceneryManager;
        ResManager = gameObject.AddComponent(typeof(ResourceManager)) as ResourceManager;
        BuildingManager = gameObject.AddComponent(typeof(BuildingManager)) as BuildingManager;
        AManager = gameObject.AddComponent(typeof(AudioManager)) as AudioManager;
        SongManager = gameObject.AddComponent(typeof(AudioSystem)) as AudioSystem;
        OverlayView = gameObject.AddComponent(typeof(GameOverlay)) as GameOverlay;
        ContextMenuView = gameObject.AddComponent(typeof(GameContextMenu)) as GameContextMenu;

        /*** Background System ***/

        // Allocate the background sprites
        BackgroundSprites = new Sprite[BackgroundLayerCount];
        for(int i = 0; i < BackgroundLayerCount; i++)
        {
            // Alloc and retain
            Sprite Background = new Sprite("Textures/BGLayer" + i);
            BackgroundSprites[i] = Background;

            // Make the sprite geometry as big as the max camera, and center it on the camera
            BackgroundSprites[i].SetGeometrySize(new Vector2(Globals.MaxCameraSize, Globals.MaxCameraSize) * 2.5f * Camera.main.aspect);
            BackgroundSprites[i].SetPosition(-BackgroundSprites[i].GetGeometrySize() / 2.0f);
            BackgroundSprites[i].SetDepth(Globals.BackgroundDepth - i); // Each layet is closer to the camera

            // Register sprite
            SManager.AddSprite(Background);
        }

        /*** Add Scene Elements & Load Enemey Spawn List ***/

        // Load the level gen. (note that we finish loading in the "OnLevelWasLoaded" because
        // of a Unity3D-specific design issue
        LevelLoaded = false;
        LevelGen = new LevelManager(TargetLevel);

        /*** TESTING: Add temp ships ***/

        // Create a few ships destroyers bottom right
        for(int i = 0; i < 6; i++)
        {
            int x = UnityEngine.Random.Range(-500, 500);
            int y = UnityEngine.Random.Range(-500, 500);

            BaseShip Friendly = null;
            if(i == 0)
                Friendly = new CarrierShip();
            else if(i == 1)
                Friendly = new DestroyerShip();
            else
                Friendly = new FighterShip();
            Friendly.SetPos(new Vector2(x, y));
            ShipManager.ShipsList.Add(Friendly);
        }
    }
 private void Awake()
 {
     m_Character = GetComponent<PlatformerCharacter2D>();
     m_ProjectileM = GetComponent<ProjectileManager>();
 }
Exemple #20
0
	void Awake ()
	{
		projectileManager = GetComponent<ProjectileManager>();
	}
Exemple #21
0
 // Use this for initialization
 void Start()
 {
     Lifes = new int[5];
     speed = 2f;
     Man = GameObject.Find("Manager").GetComponent<ProjectileManager>();
     PMan = GameObject.Find("Manager").GetComponent<PlayerManager>();
     Lifes = PMan.lifeCheck();
     bool[] pCheck = new bool[PMan.maxPCount];
     pCheck = PMan.playerCheck ();
     UporDown = Man.checkView();
     if(pCheck[0] == true && Lifes[0] < 3)
     PM = GameObject.Find("P1").GetComponent<PlayerMovement>();
     if(pCheck[1] == true && Lifes[1] < 3)
     PM2 = GameObject.Find("P2").GetComponent<PlayerMovement2>();
     if(pCheck[2] == true && Lifes[2] < 3)
     PM3 = GameObject.Find("P3").GetComponent<PlayerMovement3>();
     if(pCheck[3] == true && Lifes[3] < 3)
     PM4 = GameObject.Find("P4").GetComponent<PlayerMovement4>();
 }
	void Start()
	{
		melee      = transform.parent.GetComponent<MeleeManager>();
		projectile = transform.parent.GetComponent<ProjectileManager>();
	}
Exemple #23
0
	void Awake ()
	{
		manager = transform.parent.gameObject.GetComponent<ProjectileManager>();
	}
Exemple #24
0
    void Awake() {
        // build lookup table from stats
        Shuffle();
        for (int i = 0; i < stats.Length; i++) {
            lookup.Add(stats[i].name, i);
        }
        projectileManager = GameObject.Find("ProjectileManager").GetComponent<ProjectileManager>();

    }
 void Start()
 {
     arm        = GetComponentInChildren<ArmAnimation>();
     projectile = transform.parent.GetComponent<ProjectileManager>();
     melee      = transform.parent.GetComponent<MeleeManager>();
 }
 private void Awake()
 {
     instance = this;
 }
Exemple #27
0
 private void Start()
 {
     mProjectileManager = GameObject.Find("Main Camera").GetComponent<ProjectileManager>();
     mOriginalPosition = gameObject.transform.position;
 }
Exemple #28
0
 public void Initialize(Player player, PlayerController playerController, ProjectileManager projectileManager)
 {
     this.Owner             = player;
     this.playerController  = playerController;
     this.projectileManager = projectileManager;
 }