상속: MonoBehaviour
예제 #1
0
 void Awake()
 {
     playerAudio = GetComponent<AudioSource>();
     anim = GetComponent<Animator>();
     bossMovement = GetComponent<BossMovement>();
     isKuollut = Animator.StringToHash("isKuollut");
 }
예제 #2
0
    void Start()
    {
        instance         = this;
        basicAttack      = GetComponent <BossMovement>();
        bossAbility      = GetComponent <BossAbility>();
        bossDefense      = GetComponent <BossDefense>();
        bossResources    = GetComponentInParent <ResourceManager>();
        bossAgent        = GetComponent <NavMeshAgent>();
        disablingScripts = false;
        bossAnim         = GetComponent <Animator>();

        p_MaxHp       = 100;
        p_CurrentHP   = p_MaxHp;
        _pHealth.text = "p_Health: " + p_CurrentHP;
        p_EstimateHP  = 0;
        playerIsAlive = true;

        cdOne                 = 0;
        cdTwo                 = 0;
        cdThree               = 0;
        primaryUpgradeCount   = 0;
        defensiveUpgradeCount = 0;
        choice                = 0;

        attackDetected = false;
        this.enabled   = false;
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     hexes        = GameManage.instance.hexes;
     movementType = GameManage.instance.movementType;
     StartCoroutine(CheckShot());
     moveHexes();
 }
예제 #4
0
    void OnGUI()
    {
        GUILayout.BeginVertical();
        GUI.color = new Color(0.9f, 0.5f, 0.5f);
        if (GUILayout.Button("CreateNewLevel"))
        {
            //Just Clears Design Space, new level isn't created till the Save button pressed
            ClearLevelWorkSpace();
        }
        GUILayout.EndVertical();
        GUILayout.BeginVertical();
        GUI.color = new Color(0.3f, 0.8f, 0.6f);
        GUILayout.Label("Level Attributes------------------------------");
        levelID    = EditorGUILayout.TextField("LevelID:", levelID);
        levelName  = EditorGUILayout.TextField("LevelName:", levelName);
        biomeIndex = EditorGUILayout.Popup("Level Biome: ", biomeIndex, System.Enum.GetNames(typeof(DataTypes.BiomeType)), GUILayout.Width(250));
        //levelCanvas = PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath(levelCanvas_path, typeof(GameObject))) as GameObject;
        //levelCanvas = EditorGUILayout.ObjectField("LevelCanvas", levelCanvas,typeof(GameObject),true);
        levelPointMultiplier = EditorGUILayout.FloatField("Level Point Multiplier: ", levelPointMultiplier);
        bossLevel            = EditorGUILayout.Toggle("Is boss level: ", bossLevel);
        if (bossLevel)
        {
            movementType = (BossMovement)EditorGUILayout.EnumPopup("Boss Movement: ", movementType);
        }
        if (GUILayout.Button("Save Level"))
        {
            SaveGameData();
        }
        GUILayout.EndVertical();
        GUILayout.BeginVertical();
        GUI.color = new Color(0.3f, 0.4f, 0.6f);
        try
        {
            savedLevels = (gameData.allLevelData).Select(x => x.levelId.ToString()).ToArray();
        }
        catch
        {
            //DO Nothing
        }
        if (gameData != null && savedLevels != null)
        {
            GUILayout.Label("LOAD EXISTING LEVEL-------------------------");
            loadBiome_ind = EditorGUILayout.Popup("Load Biome: ", loadBiome_ind, System.Enum.GetNames(typeof(DataTypes.BiomeType)), GUILayout.Width(250));
            savedLevels   = (gameData.allLevelData).Where(x => x.biomeType == (DataTypes.BiomeType)loadBiome_ind).Select(x => x.levelId.ToString()).ToArray();
            loadLevel_ind = EditorGUILayout.Popup("Level ID: ", loadLevel_ind, savedLevels, GUILayout.Width(250));
            if (GUILayout.Button("Load Level"))
            {
                LoadGameData();
            }
        }
        GUILayout.EndVertical();

        GameObject hGrid = GameObject.FindGameObjectWithTag("HexGrid");

        if (hGrid != null)
        {
            GUILayout.Label("LEVEL STATS ---------------------------");
            GUILayout.Label("Blocks in level: " + hGrid.transform.childCount);
        }
    }
    void Shoot()
    {
        Vector2      mousePosition     = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y);
        Vector2      firePointPosition = new Vector2(firePoint.position.x, firePoint.position.y); //firePoint asset does not exist yet
        RaycastHit2D hit = Physics2D.Raycast(firePointPosition, mousePosition - firePointPosition, 100, whatToHit);

        Effect();
        Debug.DrawLine(firePointPosition, (mousePosition - firePointPosition) * 100); //Debug line for bullet trajectory
        if (hit.collider != null && hit.collider.tag == "Enemy")
        {
            Destroy(hit.collider.gameObject);
            Debug.DrawLine(firePointPosition, hit.point, Color.red); //Change debug line color to red when hitting something
        }
        if (hit.collider != null && hit.collider.tag == "Boss")
        {
            GameObject   boss       = GameObject.FindGameObjectWithTag("Boss");
            BossMovement bossScript = boss.GetComponent <BossMovement>();
            bossScript.hp = bossScript.hp - 20;
            if (bossScript.hp <= 0)
            {
                Destroy(hit.collider.gameObject);
                End.text = "Your time was: " + SimplePlatformController.playedTime;
            }
        }
    }
예제 #6
0
    private void LoadGameData()
    {
        //LOAD GAME DATA FROM .JSON into Editor so we can modify
        string filePath = Application.dataPath + gameDataProjectLocation;

        if (File.Exists(filePath))
        {
            string jsonDataString = File.ReadAllText(filePath);
            gameData = JsonUtility.FromJson <GameData>(jsonDataString);
        }
        else
        {
            Debug.LogWarning("No Game Data Found, Cannot Load");
            //gameData = new GameData();
        };
        //Get Data for selected level ID
        int       loadLevel = int.Parse(savedLevels[loadLevel_ind]);
        LevelData levelData = ((gameData.allLevelData).FirstOrDefault(x => x.levelId == loadLevel && x.biomeType == (DataTypes.BiomeType)loadBiome_ind));

        if ((gameData.allLevelData).Where(x => x.levelId == loadLevel && x.biomeType == (DataTypes.BiomeType)loadBiome_ind).ToList().Count() == 0)
        {
            EditorUtility.DisplayDialog("No Level Data for selected Biome/Level", "There is no data saved for level " + loadLevel + " in Biome " + (DataTypes.BiomeType)loadBiome_ind + "\nClick OK to Close window", "OK");
        }
        levelID              = levelData.levelId.ToString();
        levelName            = levelData.levelName;
        biomeIndex           = (int)levelData.biomeType;
        levelPointMultiplier = levelData.pointMultiplier;
        bossLevel            = levelData.isBossLevel;
        movementType         = levelData.movementType;
        //Debug.Log(levelData.levelId);
        BuildLoadedLevel(levelData);
    }
예제 #7
0
 public BaseBoss(Vector2 windowTilesSize, int levelNumber, BossMovement bossMovement)
     : base()
 {
     this.windowTilesSize = windowTilesSize;
     this.levelNumber     = levelNumber;
     this.bossMovement    = bossMovement;
     Position             = new Vector2(14, 4);
 }
예제 #8
0
    void OnAttackBoss(Transform boss)
    {
        // Point
        gameManager.AddPoint(100);

        BossMovement bossMove = boss.GetComponent <BossMovement>();

        bossMove.OnDamaged(attackDamage);
    }
예제 #9
0
 public Boss(ContentManager content, SpriteBatch spriteBatch, Vector2 deviceScreenSize, ScreenPad screenPad, Vector2 windowTilesSize, int levelNumber, BossMovement bossMovement)
     : base(content, spriteBatch, deviceScreenSize, screenPad)
 {
     this.windowTilesSize = windowTilesSize;
     this.levelNumber     = levelNumber;
     this.bossMovement    = bossMovement;
     bossSpriteSheet      = bossSpriteSheet ?? GetTexture(string.Format("Boss{0}SpriteSheet", levelNumber));
     bossHitSpriteSheet   = bossHitSpriteSheet ?? GetTexture(string.Format("Boss{0}HitSpriteSheet", levelNumber));
 }
예제 #10
0
    private void OnTriggerEnter2D(Collider2D hitInfo)
    {
        BossMovement enemy = hitInfo.GetComponent <BossMovement>();

        if (enemy != null)
        {
            enemy.TakeDamange(damage);
            Destroy(gameObject);
        }
    }
예제 #11
0
 void Start()
 {
     //
     trans = GetComponent <Transform>();
     boss  = GetComponentInParent <BossMovement>();
     transform.SetParent(null);
     loadingBar = GetComponentsInChildren <Transform>()[1];
     direction  = false;
     action     = true;
 }
예제 #12
0
    void Awake()
    {
        game = Game.GetGame();

        anim          = GetComponent <Animator>();
        slimeAudio    = GetComponent <AudioSource>();
        slimeMovement = GetComponent <BossMovement>();
        //slimeShooting = GetComponentInChildren<SlimeShooting>();
        currentHealth = startingHealth; // set it to a more reasonable value
    }
예제 #13
0
        public BaseBoss(Vector2 windowTilesSize, int levelNumber, BossMovement bossMovement)
            : base()
        {
            this.windowTilesSize = windowTilesSize;
            this.levelNumber     = levelNumber;
            this.bossMovement    = bossMovement;

            bossSpriteSheet    = bossSpriteSheet ?? GetTexture(GetBossSpriteSheetName(levelNumber));
            bossHitSpriteSheet = bossHitSpriteSheet ?? GetTexture(GetBossHitSpriteSheetName(levelNumber));
            Position           = new Vector2(14, 4);
        }
    private void Start()
    {
        _bossMove           = this.GetComponent <BossMovement>();
        _bossMove.enabled   = false;
        _bossHealth         = this.GetComponent <BossHealth>();
        _bossHealth.enabled = true;

        TurretL.SetActive(false);
        TurretR.SetActive(false);
        //disable TurretL and TurrentR
    }
    // Start is called before the first frame update
    protected virtual void Start()
    {
        CircleCollider2D collider = GetComponent <CircleCollider2D>();

        distanceToSpawn = collider.radius * collider.transform.localScale.x;

        movement = GetComponent <BossMovement>();

        fireTimes            = Mathf.Max(fireTimes, 1);
        principalAngleChange = angleBetweenShots / fireTimes;
    }
예제 #16
0
    void Start()
    {
        maxLife     = 500;
        currentLife = maxLife;

        bossMovement = GetComponent <BossMovement> ();
        bossMovement.SetDeltaAngle(minDeltaAngle);

        uiBossLife = FindObjectOfType <UIBossLife> ();
        uiBossLife.StartValue(maxLife);
    }
예제 #17
0
 // Use this for initialization
 void Start()
 {
     PlayerNumbers     = GameObject.FindGameObjectsWithTag("Player").Length;
     players           = GameManager.m_Instance.m_Players;
     bossmovement      = GetComponent <BossMovement>();
     m_LastShotTime    = Time.time;
     m_LastAttackTime  = Time.time;
     m_LastAttackTime2 = Time.time;
     //m_Bullet = Mode2MaxBullet;
     m_Bullet         = 0;
     playercontroller = gameObject.GetComponent <PlayerController>();
     timer            = Mode1EnemySpawnTime;
 }
예제 #18
0
    public new void Start()
    {
        if (Network.isServer) {
            base.Start();
            bossMovement = GetComponent<BossMovement>();
            characters   = GameObject.FindGameObjectsWithTag("Player");
            beamSpawn    = GameObject.Find("BeamSpawn");
            cannons      = GameObject.FindGameObjectsWithTag("BossCannonSpawn");
            initStats();

            StartCoroutine(Shoot());
            StartCoroutine(Beam());
        }
    }
예제 #19
0
    // Start is called before the first frame update
    void Start()
    {
        target = GameObject.Find("Ship");

        BA = GameObject.Find("ArmModelContainer").GetComponent <BossArm>();
        R  = GameObject.Find("Arm").GetComponent <BossArmRot>();
        BM = GameObject.Find("boss").GetComponent <BossMovement>();

        player = GameObject.Find("Ship");

        centerlight = transform.Find("Sphere").gameObject;



        Health = 50;
    }
예제 #20
0
        private void PassLevel()
        {
            levelIndex++;
            BossMovement[] bossMovements = new BossMovement[] {
                BossMovement.WalkHorizontal,
                BossMovement.FloatSenoidHorizontal,
                BossMovement.WalkHorizontal,
                BossMovement.FloatSenoidHorizontal,
                BossMovement.WalkHorizontal,
                BossMovement.WalkHorizontal,
                BossMovement.WalkHorizontal,
                BossMovement.WalkHorizontal
            };

            string[] levelNames = new string[] {
                "MEDUSA",
                "THANATOS",
                "HYDRA",
                "CYCLOPS",
                "AUTOMATON",
                "GIANT",
                "MINOTAUR",
                "ARGUS"
            };

            if (currentView != null)
            {
                currentView.UnregisterActions();
                currentView.UnloadContent();

                Content.RootDirectory = "Content";
                ContentHelper.Setup(Content);

                gameFrameTexture = ContentHelper.Instance.GetContent <Texture2D>("GameFrame");
                screenPad        = new ScreenPad
                                   (
                    this,
                    ContentHelper.Instance.GetContent <Texture2D>("ThumbBase"),
                    ContentHelper.Instance.GetContent <Texture2D>("ThumbStick"),
                    ContentHelper.Instance.GetContent <Texture2D>("ABXY_buttons")
                                   );
            }

            currentView = new View(graphics, spriteBatch, Content, screenPad, bossMovements[levelIndex], levelIndex + 1, levelNames[levelIndex]);
            currentView.RegisterActions();
        }
예제 #21
0
 private void Awake()
 {
     anim     = GetComponent <Animator>();
     sound    = GetComponent <AudioSource>();
     bossMove = GetComponent <BossMovement>();
 }
예제 #22
0
 void Start()
 {
     shotController = GetComponent <BossShotController>();
     moveController = GetComponent <BossMovement>();
 }
예제 #23
0
	// Use this for initialization
	void Start () {
		SetupAbilities ();
		bossMove = GetComponent<BossMovement> ();
	}
 public ViewStateTheEnd(GraphicsDeviceManager graphics, ContentManager content, ScreenPad screenPad, BossMovement bossMovement, int levelNumber, string levelName, IJsonMapManager jsonMapManager)
     : base(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager)
 {
 }
예제 #25
0
 void Start()
 {
     eManager = GetComponent<EyeBossManager>();
     eMove    = GetComponent<BossMovement>();
     health   = eManager.health;
     enemyBar = HudOn.fillTex(60, 10, new Color(1f, 0f, 0f, 1f));
     HudOn.bossOn = true;
 }
예제 #26
0
 // Start is called before the first frame update
 void Start()
 {
     movement = gameObject.GetComponent <BossMovement>();
     attack   = GetComponent <BossAttackManager>();
     health   = GetComponent <BossHealthComponent>();
 }
예제 #27
0
 public Boss(Vector2 windowTilesSize, int levelNumber, BossMovement bossMovement)
     : base(windowTilesSize, levelNumber, bossMovement)
 {
     position = new Vector2(16, 16);
 }
예제 #28
0
 public ViewStateBase(GraphicsDeviceManager graphics, ContentManager content, ScreenPad screenPad, BossMovement bossMovement, int levelNumber, string levelName, IJsonMapManager jsonMapManager)
 {
     this.content        = content;
     this.graphics       = graphics;
     this.content        = content;
     this.screenPad      = BaseResolver.Instance.Resolve <IScreenPad>();
     this.levelNumber    = levelNumber;
     this.levelName      = levelName;
     this.topLeftCorner  = new Vector2((screenSize.X - gameScreenSize.X) / 2, (screenSize.Y - gameScreenSize.Y) / 2);
     this.jsonMapManager = jsonMapManager;
     camera2d            = BaseResolver.Instance.Resolve <ICamera2d>();
     DefineActions();
 }
예제 #29
0
        public View(GraphicsDeviceManager graphics, ContentManager content, ScreenPad screenPad, BossMovement bossMovement, int levelNumber, string levelName, IJsonMapManager jsonMapManager)
        {
            viewStatesDic.Add(ViewState.Intro, new ViewStateIntro(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager));
            viewStatesDic.Add(ViewState.Menu, new ViewStateMenu(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager));
            viewStatesDic.Add(ViewState.ShowLevel, new ViewStateShowLevel(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager));
            viewStatesDic.Add(ViewState.Playing, new ViewStatePlaying(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager));
            viewStatesDic.Add(ViewState.TheEnd, new ViewStateTheEnd(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager));
            viewStatesDic.Add(ViewState.GameOver, new ViewStateGameOver(graphics, content, screenPad, bossMovement, levelNumber, levelName, jsonMapManager));

            currentViewState = viewStatesDic[ViewState.Menu];

            NewMessenger.Default.Register <ViewStateChangedMessage>(this, (message) =>
            {
                foreach (var viewState in viewStatesDic.Values)
                {
                    viewState.UnregisterActions();
                }

                currentViewState = viewStatesDic[message.ViewState];
                currentViewState.RegisterActions();

                if (message.ViewState == ViewState.Intro)
                {
                    currentViewState.InitializeLevel();
                }
            });
        }
예제 #30
0
 // Use this for initialization
 void Start()
 {
     SetupAbilities();
     bossMove = GetComponent <BossMovement> ();
 }