void cancelAttack()
 {
     anim.SetTrigger(hurtHash);
     triggerSet = false;
     actionPoints2.emptyMeter();
     nextAttack = getRandomAttack();
 }
Пример #2
0
    void displayNextAttack(DragonAttack attack)
    {
        switch (attack)
        {
        case DragonAttack.TailSwipe:
            nextAttack.text = "Bite:\nCounter with Earth";
            return;

        case DragonAttack.Fireball:
            nextAttack.text = "Fireball:\nCounter with Water";
            return;

        case DragonAttack.Earthquake:
            nextAttack.text = "Earthquake:\nCounter with Lightning";
            return;

        case DragonAttack.SnotBomb:
            nextAttack.text = "Snot Bomb:\nCounter with Wind";
            return;

        default:
            nextAttack.text = "Attack Countered!";
            return;
        }
    }
    void doRandomAttack(DragonAttack attack)
    {
        anim.SetTrigger(attackHash);
        triggerSet = false;
        switch (attack)
        {
        case DragonAttack.TailSwipe:
            tailSwipe();
            return;

        case DragonAttack.Fireball:
            fireball();
            return;

        case DragonAttack.Earthquake:
            earthquake();
            return;

        case DragonAttack.SnotBomb:
            snotbomb();
            return;

        default:
            return;
        }
    }
Пример #4
0
    void scryingShield()
    {
        utility = true;
        heroClass.getActionPoints().usePoints();
        DragonAttack attack = GameController.GetComponent <GameController>().getNextAttack();

        displayNextAttack(attack);
    }
Пример #5
0
    private void ConstructFSM()
    {
        Vector3[] wayPoints = null;
        if (pathList != null)
        {
            wayPoints = new Vector3[pathList.Count];
            pathList.CopyTo(wayPoints, 0);
        }

        DragonIdle idle = new DragonIdle(wayPoints, this);

        idle.AddTransition((int)Transition.SawPlayer, (int)FSMActionID.Chase);
        idle.AddTransition((int)Transition.Disappear, (int)FSMActionID.Disappear);

        DragonChase chase = new DragonChase(wayPoints, this);

        chase.AddTransition((int)Transition.Disappear, (int)FSMActionID.Disappear);
        chase.AddTransition((int)Transition.Hold, (int)FSMActionID.Hold);
        chase.AddTransition((int)Transition.Attack, (int)FSMActionID.Attack);

        DragonAttack attack = new DragonAttack(wayPoints, this);

        attack.AddTransition((int)Transition.Explode, (int)FSMActionID.Explode);
        attack.AddTransition((int)Transition.Disappear, (int)FSMActionID.Disappear);

        DragonDisappear disappear = new DragonDisappear(wayPoints, this);

        DragonHold hold = new DragonHold(wayPoints, this);

        hold.AddTransition((int)Transition.Success, (int)FSMActionID.Retreat);
        hold.AddTransition((int)Transition.Fail, (int)FSMActionID.Beat);

        DragonBeat beat = new DragonBeat(wayPoints, this);

        beat.AddTransition((int)Transition.Disappear, (int)FSMActionID.Disappear);

        DragonRetreat retreat = new DragonRetreat(wayPoints, this);

        retreat.AddTransition((int)Transition.Disappear, (int)FSMActionID.Disappear);

        DragonExplode explode = new DragonExplode(wayPoints, this);

        AddFSMState(idle);
        AddFSMState(chase);
        AddFSMState(attack);
        AddFSMState(disappear);
        AddFSMState(hold);
        AddFSMState(beat);
        AddFSMState(retreat);
        AddFSMState(explode);

        StartFSM(chase);
    }
Пример #6
0
        public override Skill Clone(int value)
        {
            var tmp = new DragonAttack
            {
                Description = Description,
                MaxValue    = MaxValue,
                Name        = Name,
                Value       = value
            };

            return(tmp);
        }
    void attackCommand(AttackAtt myAttack, Target[] targets, int targetNumber, DragonAttack attackName, GameObject prefab)
    {
        EnemyAttack attack;

        attack.phDamage     = damageModule.phAttackDamage(myAttack, 1.0f);
        attack.maDamage     = damageModule.maAttackDamage(myAttack, 1.0f);
        attack.attackName   = attackName;
        attack.targetNumber = targetNumber;
        attack.targets      = new Target[targetNumber];
        attack.ailment      = myAttack.ailment;
        attack.ailChance    = myAttack.chance;
        for (int i = 0; i < targetNumber; ++i)
        {
            attack.targets[i] = targets[i];
        }
        attack.prefab = prefab;
        GameController.GetComponent <GameController>().EnemyQueue.Enqueue(attack);
    }
    void Awake()
    {
        stateAttack = new DragonStateAttack();
        stateDie    = new DragonStateDie();
        stateIdle   = new DragonStateIdle();
        stateMove   = new DragonStateMove();

        FSM = new FiniteStateMachine <DragonController>();

        dragonAnimation = this.transform.GetChild(0).GetComponent <DragonAnimation>();
        dragonAttack    = this.GetComponentInChildren <DragonAttack>();

        StateAction    = EDragonStateAction.IDLE;
        StateDirection = EDragonStateDirection.NONE;
        StateOffense   = EDragonStateOffense.NONE;

        initalize();
    }
 // Update is called once per frame
 void Update()
 {
     dragonText.text = healthBar.getHealthString();
     addPoints();
     counterBool = setCounterBool();
     setCounterColor();
     if (counter())
     {
         cancelAttack();
     }
     if (actionPoints2.getMeter() > counterWindow)
     {
         setAnimationTrigger();
         makeTimerVisible();
     }
     if (actionPoints2.isReady() && !gameOver())
     {
         doRandomAttack(nextAttack);
         actionPoints2.usePoints();
         nextAttack = getRandomAttack();
         resetAttackTimerPos();
     }
     if (timerCount == TIMER_MAX)
     {
         GameController.GetComponent <GameController>().gameOver();
     }
     else if (actionPoints.isReady())
     {
         ++timerCount;
         if (timerCount < TIMER_MAX)
         {
             powerUp();
             setTimerColor(doomsdayTimer);
         }
     }
 }
 // Use this for initialization
 void Start()
 {
     damageModule.setAttribute(Attribute.PhysicalAttack, defaultPhAtk);
     damageModule.setAttribute(Attribute.MagicalAttack, defaultMaAtk);
     damageModule.setAttribute(Attribute.PhysicalDefense, defaultPhDef);
     damageModule.setAttribute(Attribute.MagicalDefense, defaultMaDef);
     damageModule.setAttribute(Attribute.Resistance, defaultRes);
     damageModule.setAttribute(Attribute.Speed, defaultSpd);
     damageModule.setWeakness(defaultElement);
     GameController = GameObject.Find("GameController");
     attributes     = GameObject.Find("CharacterAttributes");
     Self           = GameObject.Find("Dragon");
     myTailSwipe    = attributes.GetComponent <CharacterAttributes>().getAttackAtt("DragonTailSwipe");
     myFireball     = attributes.GetComponent <CharacterAttributes>().getAttackAtt("DragonFireball");
     myEarthquake   = attributes.GetComponent <CharacterAttributes>().getAttackAtt("DragonEarthquake");
     mySnotbomb     = attributes.GetComponent <CharacterAttributes>().getAttackAtt("DragonHaze");
     setDoomsdayTimer(doomsdayTimer);
     setHealthBar(Self, health);
     nextAttack = getRandomAttack();
     setPositions();
     resetAttackTimerPos();
     audioSource = GetComponent <AudioSource>();
     anim        = GetComponentInChildren <Animator>();
 }
    void Awake()
    {
        stateAttack = new DragonStateAttack();
        stateDie = new DragonStateDie();
        stateIdle = new DragonStateIdle();
        stateMove = new DragonStateMove();

        FSM = new FiniteStateMachine<DragonController>();

        dragonAnimation = this.transform.GetChild(0).GetComponent<DragonAnimation>();
        dragonAttack = this.GetComponentInChildren<DragonAttack>();

        StateAction = EDragonStateAction.IDLE;
        StateDirection = EDragonStateDirection.NONE;
        StateOffense = EDragonStateOffense.NONE;

        initalize();
    }
Пример #12
0
 public DragonJewel1()
 {
     Name  = "Dragon Jewel 1";
     Skill = new DragonAttack(1);
     Type  = SlotType.Small;
 }
Пример #13
0
    // Use this for initialization
    void Start()
    {
        string username = "******";

        if (!isLocalPlayer)
        {
            DisableComponents();
            AssignRemoteLayer();
        }
        else
        {
            // If we have a main camera and it has been marked as main
            //sceneCamera = Camera.main;
            if (sceneCamera != null)
            {
                //sceneCamera.gameObject.SetActive(false);
            }

            playerUIInstance      = Instantiate(playerUIPrefab);
            playerUIInstance.name = playerUIPrefab.name;

            PlayerUI playerUI = playerUIInstance.GetComponent <PlayerUI>();  // PlayerUI component of the PlayerUI instance

            EnergyScript energy = this.gameObject.GetComponent <EnergyScript>();
            energy.energyBarImage = playerUI.energyBar;
            energy.chargeBarImage = playerUI.chargeEnergyBar;

            Health health = this.gameObject.GetComponent <Health>();
            health.HealthImage = playerUI.healthBar;

            //     HealthBarManager healthBarManager = GameObject.FindObjectOfType<HealthBarManager>();


            ComboMeter combometer = this.gameObject.GetComponent <ComboMeter>();
            combometer.ComboCounterText = playerUI.comboCounterText;
            combometer.ComboTimerBar    = playerUI.comboCounterTimer;

            DragonAttack dragonAttack = this.gameObject.GetComponent <DragonAttack>();
            dragonAttack.raycaster = playerUIInstance.GetComponent <GraphicRaycaster>();

            Radar radar = this.gameObject.GetComponent <Radar>();
            radar = playerUI.radar;

            MoveJoystick joystick = playerUI.joystick.GetComponent <MoveJoystick>();
            this.gameObject.GetComponent <PlayerMovement>().SetJoystick(joystick);

            bStartTimeCheck = false;
        }

        RegisterPlayer();
        GetComponent <Player>().Setup();


        if (UserAccountManager.IsLoggedIn)
        {
            username = UserAccountManager.LoggedIn_Username;
        }
        else
        {
            username = transform.name;
        }

        CmdSetUsername(transform.name, username);
    }
Пример #14
0
    void OnTriggerEnter(Collider other)
    {
        // If the enemy is dead...
        if (isDead)
        {
            // ... no need to take damage so exit the function.
            return;
        }

        if (notAttacked)                                                                                // If the dragon has not yet been attacked:
        {
            if (other.gameObject.CompareTag("PlayerSword") || other.gameObject.CompareTag("EpicSword")) // If the dragon is attacked by the player:
            {
                Quests.dragon = 1;
                aggro         = GetComponent <DragonAttack>();
                // Get the Dragon Attack script attached to the dragon head that got attacked.
                aggroAlly = otherOne.GetComponent <DragonAttack>();
                // Get the Dragon Attack script for the second dragon head.
                aggroSecondAlly = thirdOne.GetComponent <DragonAttack>();
                // Get the Dragon Attack script for the third dragon head.
                dragonAlly                   = otherOne.GetComponent <Dragon>(); // Get the Dragon script for the second dragon head.
                secondDragonAlly             = thirdOne.GetComponent <Dragon>(); // Get the Dragon script for the third dragon head.
                aggro.hostile                = true;                             // The attacked dragon head becomes hostile.
                aggroAlly.hostile            = true;                             // The second dragon head becomes hostile.
                aggroSecondAlly.hostile      = true;                             // The third dragon head becomes hostile.
                notAttacked                  = false;                            // Dragon has been attacked.
                dragonAlly.notAttacked       = false;                            // Dragon has been attacked.
                secondDragonAlly.notAttacked = false;                            // Dragon ahs been attacked.
            }
        }

        if (other.gameObject.CompareTag("PlayerSword")) // If the player's regular sword hits the dragon.
        {
            currentHealth -= 30;                        // Deal 30 damage.
        }

        if (other.gameObject.CompareTag("EpicSword")) // If the player's epic sword hits the dragon.
        {
            currentHealth -= 9001;                    // Deal over 9,000 damage.
        }

        if (other.gameObject.CompareTag("Dovahkiid")) // If the Dovahkiid hits the dragon.
        {
            currentHealth -= 15000;                   // Kill the dragon.
        }

        // If the current health is less than or equal to zero...
        if (currentHealth <= 0)
        {
            isDead = true;                                      // The dragon head is now dead.
            Quests.dragonCount--;                               // subtract one from the number of living dragon heads.
            if (Quests.dragonCount == 0)                        // If all heads are gone:
            {
                if (other.gameObject.CompareTag("PlayerSword")) // If dragon was killed by regular player sword:
                {
                    Quests.dragon = 5;                          // Set appropriate quest state.
                }
                if (other.gameObject.CompareTag("EpicSword"))   // If dragon was killed by epic sword:
                {
                    Quests.dragon = 2;                          // Set appropriate quest state.
                }
                if (other.gameObject.CompareTag("Dovahkiid"))   // If dragon was killed by Dovahkiid:
                {
                    Quests.dragon = 3;                          // Set appropriate quest state.
                }

                GlobalControl.Instance.npc    = Quests.npcCount;
                GlobalControl.Instance.thief  = Quests.thieves;
                GlobalControl.Instance.dragon = Quests.dragon;
                SceneManager.LoadScene("GameOver"); // Load game ending scene.
            }
            Destroy(gameObject);                    // Destroy the dragon head's game object.
        }
    }