Exemple #1
0
    public void Use(GameObject user)
    {
        Enemy_AI        aI           = GameObject.Find("Enemy").GetComponent <Enemy_AI>();
        CoolDownManager aiCDMaganger = GameObject.Find("Enemy").GetComponent <CoolDownManager>();
        Skill           ba           = new BasicAttack();

        if (user == GameObject.Find("Player") && !Skill_Handler.isBroken && skill_Handler.QSlot.cdEnd && skill_Handler.state == Skill_Handler.ButtonState.qActive)
        {
            playerShot = true;
            BulletDirection thisBullet = Instantiate(Bullet, firepoint.position, Quaternion.identity);
            thisBullet.gameObject.name = "PlayerBullet";

            skill_Handler.QSlot.CoolDownCounter(CreatePlayer.chosenShip.QSkill, skill_Handler.qSkillSlot);
        }

        if (user == GameObject.Find("Enemy") && !aI.isBroken && cdEnd)
        {
            BulletDirection thisBullet = (BulletDirection)Instantiate(Bullet, firepoint.position, Quaternion.identity);
            thisBullet.transform.rotation = Quaternion.Euler(0, 180f, 0);
            thisBullet.gameObject.name    = "EnemyBullet";
            thisBullet.EnemyShot();

            if (Circle_Move_Behaviour.enemyCircleMove)
            {
                ba.SkillCoolDown = 1;
            }

            StartCoroutine(SimpleCoolDown(CreateEnemy.EnemyShip.QSkill.SkillCoolDown));
        }
    }
    /// <summary>
    /// Function that will be called to draw each visible element on screen
    /// The occupied area calculation will be made in another place to separate the logic to show one menu element of the rest
    /// </summary>
    /// <param name="rect">Area to draw your menu element</param>
    /// <param name="elementIndex">Index of the element that should be drawn</param>
    /// <param name="isActive">True if that element is active. False otherwise</param>
    public override void DrawElement(Rect rect, int elementIndex, bool isActive)
    {
        switch (numOfSlotsAvailable)
        {
        case 1:
            if (elementIndex > 0)
            {
                return;
            }
            break;

        case 2:
            if (elementIndex % 2 == 0)
            {
                return;
            }
            elementIndex--;
            break;

        case 3:
            if (elementIndex == 2)
            {
                return;
            }
            break;
        }

        if (abilityBorder)
        {
            GUI.DrawTexture(elementBorder.GetRect(rect), abilityBorder, ScaleMode.ScaleToFit);
        }
        Area ultAnimalFull = new Area(elementContent.GetRect(rect));

        float percent = CoolDownManager.RemainingTimePercent(abilities[elementIndex].description.id.ToString());

        if (isActive && this.isActive)
        {
            GUI.DrawTexture(ultAnimalFull.GetRect(), selectedImage.GetTexture(), ScaleMode.ScaleToFit);
        }
        else
        {
            GUI.DrawTexture(ultAnimalFull.GetRect(), abilities[elementIndex].texture, ScaleMode.ScaleToFit);
        }
        if (percent > 0)
        {
            percent = percent / 2;
            GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.UP);

            GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.DOWN);

            GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.LEFT);

            GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.RIGHT);
        }

        if ((abilities[elementIndex].description.id != Ability.AbilityId.NONE) && ButtonManager.Get(ButtonManager.ButtonID.L2))
        {
            GUI.DrawTexture(buttonArea.GetRect(rect), ButtonManager.GetButtonTexture((ButtonManager.ButtonID)elementIndex));
        }
    }
Exemple #3
0
    void Start()
    {
        countDown = countDownObject.GetComponent <CountDown>();

        playerHealthBar   = playerHealthBarObject.GetComponent <HealthBar>();
        opponentHealthBar = opponentHealthBarObject.GetComponent <HealthBar>();

        coolDownManager = coolDownObject.GetComponent <CoolDownManager>();

        gameOverPanel = gameOverPanelObject.GetComponent <GameOverPanel>();

        enemyCard = enemyCardObject.GetComponent <EnemyCard>();

        tagCloud = tagCloudObject.GetComponent <TagCloud>();

        menu = menuPanelObject.GetComponent <Menu>();
    }
Exemple #4
0
    public override float ReceiveDamage(Vector2 direction, float force, float damage, bool critical = false, Commandments.Element attackerElement = Commandments.Element.NEUTRAL, Character source = null)
    {
        if (currentState == "dying")
        {
            return(0);
        }

        float receivedDamage = 0;
        bool  ret            = CoolDownManager.Apply(Identifiers.Invulnerability.ToString(), gameObject, invulnerabilityTime, () =>
        {
            damage *= damageModifier[attackerElement.toInt()];

            receivedDamage = base.ReceiveDamage(direction, force, damage, critical, attackerElement, source);

            if (hp <= 0)
            {
                if (takingDamageParameter != null)
                {
                    animator.ResetTrigger(takingDamageParameter.name);
                }
                if (critical)
                {
                    float criticalValue = 100 * Random.value;



                    if (criticalValue > (100 - scriptDropChance * Commandments.Modifiers.IncreaseScriptDropRate.GetValue()))
                    {
                        GameManager.GetInstance().SpawnYokaiEssence(transform.position, yokaiRank, player);
                    }
                }
                Dying();
            }

            return(true);
        });

        ////print("Received Damage = " + receivedDamage);
        return(receivedDamage);
    }
Exemple #5
0
    public void DrawBuffPlay()
    {
        if (player.modifiers.Count == 0)
        {
            return;
        }

        //print((( player.buffs[0] + " - " + player.buffs[0].cooldown.isOnCD());
        int firstLineCount  = 0;
        int secondLineCount = 0;

        for (int i = 0; i < player.modifiers.Count; i++)
        {
            if (CoolDownManager.RemainingTimeAbsolute("mod_" + player.modifiers[i].ToString()) == float.PositiveInfinity && player.modifiers[i].isBuff())
            {
                continue;
            }
            if (CoolDownManager.RemainingTimePercent("mod_" + player.modifiers[i].ToString()) > 0)
            {
                if (firstModifier == 0)
                {
                    if (player.modifiers[i].isBuff())
                    {
                        firstModifier = 1;
                    }
                    else
                    {
                        firstModifier = -1;
                    }
                }
                Rect rect;
                if ((player.modifiers[i].isBuff() && firstModifier == 1) || (!player.modifiers[i].isBuff() && firstModifier == -1))
                {
                    rect = firstLine[firstLineCount].GetRect();
                    firstLineCount++;
                }
                else
                {
                    rect = secondLine[secondLineCount].GetRect();
                    secondLineCount++;
                }

                if (modTextures.Contains(player.modifiers[i]))
                {
                    GUI.DrawTexture(rect, modTextures[player.modifiers[i]], ScaleMode.ScaleToFit);
                }
            }
            else
            {
                player.RemoveModifier(player.modifiers[i]);
                i = 0;
            }
        }

        //print("1stLine = " + firstLineCount + "\t2ndLine = " + secondLineCount + "\tfirstModifier = " + firstModifier);

        if (firstModifier == 1)
        {
            if (firstLineCount == 0)
            {
                if (secondLineCount == 0)
                {
                    firstModifier = 0;
                }
                else
                {
                    //print("else");
                    firstModifier = -1;
                }
            }
        }
        else if (firstModifier == -1)
        {
            if (firstLineCount == 0)
            {
                if (secondLineCount == 0)
                {
                    firstModifier = 0;
                }
                else
                {
                    firstModifier = 1;
                }
            }
        }
    }
Exemple #6
0
 public CDataPool()
 {
     mCoolDownManager  = new CoolDownManager();
     mPlayerBuffImpact = new PlayerBuffImpact();
 }
 void Awake()
 {
     instance = this;
 }
Exemple #8
0
 void Start()
 {
     usedTags        = new Dictionary <string, int>();
     coolDownManager = GetComponent <CoolDownManager>();
     InvokeRepeating("Timer", 0, 1);
 }
Exemple #9
0
 void LateUpdate()
 {
     CoolDownManager.clean();
 }