Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        ExploreCat cat = (ExploreCat)target;

        // type = (CatType)EditorGUILayout.EnumPopup(type);
        if (GUILayout.Button("LOVE PARTICLE"))
        {
            cat.loveParticles();
        }
        if (GUILayout.Button("MAGIC PARTICLE"))
        {
            cat.Magic();
        }
        if (GUILayout.Button("FADE"))
        {
            cat.FadeAndAvoidHit();
        }
        if (GUILayout.Button("FLY"))
        {
            cat.FlyAndAvoidHit();
        }
        if (GUILayout.Button("SET TEXTURE"))
        {
            cat.sideEffect = new SideEffect(Fx.Scared, SecondaryType.Arrow);
            cat.setEffect();
        }
    }
Esempio n. 2
0
    // private bool hasPlayerWon()
    // {
    //     if (enemyPlayer.getNumLivingCats() == 0)
    //     {
    //         return true;
    //     }
    //     return false;
    // }

    // private bool hasPlayerLost()
    // {
    //     if (userPlayer.getNumLivingCats() == 0)
    //     {
    //         return true;
    //     }
    //     return false;
    // }


    private void sideEffectReact(SideEffect effect, ExploreCat effectee)
    {
        string[] effectNotifs = null;
        string   secondstring = null;
        float    damage       = 0;

        // if (cat.owner.enemy)
        // {
        //     exploreChoice.getCurrentUser().Disable();
        // }
        switch (effect.effect)
        {
        case Fx.Love:
            effectNotifs = new string[] {
                effectee.cat.Name + " loves their foe too much to focus!",
                effectee.cat.Name + " likes their foe so much that they refuse to battle.",
                effectee.cat.Name + " is too distracted by their love for their foe to pay attention!",
                effectee.cat.Name + " is too busy feeling adoration for their foe!",
                effectee.cat.Name + " wants to make friends, not war!",
            };
            if (UnityEngine.Random.value > 0.6f)
            {
                damage       = effectee.realizedStats.maxHealth * 0.025f;
                secondstring = effectee.cat.Name + " feels hurt at the thought of fighting!";
            }
            break;

        case Fx.Confused:
            effectNotifs = new string[] {
                effectee.cat.Name + " is too confused by the " + effect.effector.ToString().ToLower() + " to fight!",
                effectee.cat.Name + " is too bewildered by the " + effect.effector.ToString().ToLower() + " to attack!",
                effectee.cat.Name + " is caught off guard by the " + effect.effector.ToString().ToLower() + "!",
                effectee.cat.Name + " is confused; they've never seen a " + effect.effector.ToString().ToLower() + " before!",
            };
            if (UnityEngine.Random.value > 0.75f)
            {
                damage       = effectee.realizedStats.maxHealth * 0.05f + 1;
                secondstring = effectee.cat.Name + " got hurt in their confusion!";
            }
            break;

        case Fx.Distracted:
            effectNotifs = new string[] {
                effectee.cat.Name + " is too distracted by the " + effect.effector.ToString().ToLower() + " to attack!",
                effectee.cat.Name + " bats the " + effect.effector.ToString().ToLower() + " happily, forgetting to attack!",
                effectee.cat.Name + " is too busy playing with the " + effect.effector.ToString().ToLower() + " to attack!",
                effectee.cat.Name + " ignores the fight to paw at the " + effect.effector.ToString().ToLower() + "!",
            };
            break;

        case Fx.Scared:
            effectNotifs = new string[] {
                effectee.cat.Name + "'s too scared of the " + effect.effector.ToString().ToLower() + " to move!",
                effectee.cat.Name + " is frozen in fear of the " + effect.effector.ToString().ToLower() + "!",
                effectee.cat.Name + " is too frightened of the " + effect.effector.ToString().ToLower() + " to do anything!",
            };
            if (UnityEngine.Random.value > 0.45f)
            {
                damage       = effectee.realizedStats.maxHealth * 0.05f + 2;
                secondstring = effectee.cat.Name + " got hurt in their fright!";
            }
            break;
        }
        if (effectNotifs != null)
        {
            if (effectee.currentHealth <= 0)
            {
                effectee.onHit(AttackType.None, effectee);
                return;
            }
            if (effectee.owner.enemy)
            {
                exploreChoice.getCurrentUser().Disable();
            }

            string[] notifs = (secondstring == null) ? new string[] {
                effectNotifs[UnityEngine.Random.Range(0, effectNotifs.Length)]
            } : new string[] {
                effectNotifs[UnityEngine.Random.Range(0, effectNotifs.Length)],
                secondstring
            };

            Notify(notifs, () =>
            {
                effectee.onHit(AttackType.None, effectee);
                if (damage > 0)
                {
                    effectee.takeDamage(damage);
                }
            });
            effectee.setEffect();
        }
    }