Пример #1
0
 public void DisableAllAttacks()
 {
     foreach (Attack ActiveAttack in ListAttack)
     {
         ActiveAttack.DisableAttack();
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (darkenTheSkiesSpell.spellLevel >= 1)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                if (pStats.curMagic - darkenTheSkiesSpell.magicRequired >= 0)
                {
                    if (Time.time > spell1CDTimer)
                    {
                        isActive = ActiveAttack.Spell1;
                    }
                    else
                    {
                        Debug.Log(spell1CDTimer - Time.time + " seconds remaining.");
                    }
                }
                else
                {
                    Debug.Log("Insufficient Magic");
                    return;
                }
            }
        }

        if (headShotSpell.spellLevel >= 1)
        {
            if (Input.GetButtonDown("Fire2"))
            {
                if (pStats.curMagic - headShotSpell.magicRequired >= 0)
                {
                    if (Time.time > spell2CDTimer)
                    {
                        isActive = ActiveAttack.Spell2;
                    }
                    else
                    {
                        Debug.Log(spell2CDTimer - Time.time + " seconds remaining.");
                    }
                }
                else
                {
                    Debug.Log("Insufficient Magic");
                    return;
                }
            }
        }


        if (isActive == ActiveAttack.Spell1 || isActive == ActiveAttack.Spell2)
        {
            if ((Input.GetButton("Cancel")) || (Input.GetMouseButton(1)))
            {
                isActive = ActiveAttack.None;
            }
        }
    }
Пример #3
0
 public void UpdateAllAttacks(Vector3 StartPosition, Vector3 TargetPosition, bool[,] ArrayTargetMapSize, string TargetMovementType, bool CanMove)
 {
     foreach (Attack ActiveAttack in ListAttack)
     {
         if (!ActiveAttack.CanAttack)
         {
             ActiveAttack.UpdateAttack(this, StartPosition, TargetPosition, ArrayTargetMapSize, TargetMovementType, CanMove);
         }
     }
 }
 private void startStrongAttackDelay()
 {
     messenger.Invoke(Message.START_ATTACK_DELAY, new object[] { strongAttackDelay });
     activeAttack          = ActiveAttack.STRONG_DELAY;
     numDefaultAttacksDone = 0;
     currentTimePassed     = 0;
     if (currentHelmet == null)
     {
         currentHelmet = Instantiate(helmetPrefab, helmetSpawnLocation.position, Quaternion.identity) as GameObject;
     }
 }
Пример #5
0
    void Start()
    {
        //bBehaviour = GameObject.Find("Bow").GetComponent<BowBehaviour>();
        headShotSpell       = GameObject.Find("HeadShot").GetComponent <HeadShot>();
        darkenTheSkiesSpell = GameObject.Find("DarkenTheSkies").GetComponent <DarkenTheSkies>();
        pStats = GameObject.Find("Archer").GetComponent <PlayerStats>();
        // pSkillMap = GameObject.Find("Archer").GetComponent<PlayerSkillMap>();

        isActive      = ActiveAttack.None;
        spell1CDTimer = 0.0f;
        spell2CDTimer = 0.0f;
    }
Пример #6
0
 public void UpdateNonMAPAttacks(Vector3 StartPosition, Vector3 TargetPosition, bool[,] ArrayTargetMapSize, string TargetMovementType, bool CanMove)
 {
     foreach (Attack ActiveAttack in ListAttack)
     {
         if (ActiveAttack.Pri != WeaponPrimaryProperty.MAP)
         {
             ActiveAttack.UpdateAttack(this, StartPosition, TargetPosition, ArrayTargetMapSize, TargetMovementType, CanMove);
         }
         else
         {
             ActiveAttack.DisableAttack();
         }
     }
 }
 void Start()
 {
     activeAttack = ActiveAttack.DEFAULT_DELAY;
     messenger    = GetComponent <IMessenger>();
     if (messenger == null)
     {
         messenger = GetComponentInParent <IMessenger>();
     }
     if (messenger == null)
     {
         messenger = GetComponentInChildren <IMessenger>();
     }
     playerPickupController = player.GetComponent <PickupController>();
 }
Пример #8
0
 public void ActivateSkill(ActiveSpell spell)
 {
     if (spell == darkenTheSkiesSpell)
     {
         if (pStats.curMagic - darkenTheSkiesSpell.magicRequired >= 0)
         {
             if (Time.time > spell1CDTimer)
             {
                 isActive = ActiveAttack.Spell1;
             }
             else
             {
                 Debug.Log(spell1CDTimer - Time.time + " seconds remaining.");
             }
         }
         else
         {
             Debug.Log("Insufficient Magic");
             return;
         }
     }
     else if (spell == headShotSpell)
     {
         if (pStats.curMagic - headShotSpell.magicRequired >= 0)
         {
             if (Time.time > spell2CDTimer)
             {
                 isActive = ActiveAttack.Spell2;
             }
             else
             {
                 Debug.Log(spell2CDTimer - Time.time + " seconds remaining.");
             }
         }
         else
         {
             Debug.Log("Insufficient Magic");
             return;
         }
     }
 }
    private void startDefaultAttack()
    {
        // Choose spawn point that is closes to player
        int minDistanceIndex = 0;

        if (player != null)
        {
            float minDistance = Vector2.Distance(player.position, defaultSpawnPoints[0].position);
            for (int i = 1; i < defaultSpawnPoints.Length; i++)
            {
                if (Vector2.Distance(player.position, defaultSpawnPoints[i].position) < minDistance)
                {
                    minDistance      = Vector2.Distance(player.position, defaultSpawnPoints[i].position);
                    minDistanceIndex = i;
                }
            }
            defaultAttackSpawnPoint = defaultSpawnPoints[minDistanceIndex];
            activeAttack            = ActiveAttack.DEFAULT;
            currentTimePassed       = 0;
            numDefaultAttacksDone++;
        }
    }
    void Update()
    {
        currentTimePassed += Time.deltaTime;
        switch (activeAttack)
        {
        case ActiveAttack.DEFAULT_DELAY:
            if (currentTimePassed >= defaultAttackDelay)
            {
                if (numDefaultAttacksDone >= numDefaultAttacksBeforeStrong)
                {
                    numDefaultAttacksDone = 0;
                    startStrongAttackDelay();
                }
                else
                {
                    startDefaultAttack();
                }
            }
            break;

        case ActiveAttack.DEFAULT:
            if (currentTimePassed >= defaultAttackDuration)
            {
                activeAttack = ActiveAttack.DEFAULT_DELAY;
            }
            else
            {
                if (Random.value <= defaultAttackSpawnRate)
                {
                    spawnDefaultAttackSpike();
                }
            }
            break;

        case ActiveAttack.STRONG_DELAY:
            if (currentTimePassed >= strongAttackDelay)
            {
                startStrongAttack();
            }
            break;

        case ActiveAttack.STRONG:
            if (currentTimePassed >= strongAttackDuration)
            {
                activeAttack      = ActiveAttack.LONG_DELAY;
                currentTimePassed = 0;
            }
            else
            {
                foreach (Transform spawnPoint in strongAttackSpawnPoints)
                {
                    if (Random.value <= defaultAttackSpawnRate)
                    {
                        spawnStrongAttackSpike(spawnPoint);
                    }
                }
            }
            break;

        case ActiveAttack.LONG_DELAY:
            if (currentTimePassed >= longDelay)
            {
                activeAttack      = ActiveAttack.DEFAULT_DELAY;
                currentTimePassed = 0;
                playerPickupController.DeactivateHelmetPowerup();
            }
            break;
        }
    }
 private void startStrongAttack()
 {
     activeAttack      = ActiveAttack.STRONG;
     currentTimePassed = 0;
 }