Ejemplo n.º 1
0
    public override void CopyValues(ScrObjLibraryEntry other)
    {
        base.CopyValues(other);
        CharacterSkill cs = (CharacterSkill)other;

        icon           = cs.icon;
        description    = cs.description;
        activationType = cs.activationType;

        chance  = cs.chance;
        percent = cs.percent;
        value   = cs.value;
        boost   = new Boost();
        boost.AddBoost(cs.boost);

        includeSelf    = cs.includeSelf;
        range          = cs.range;
        rangeMax       = cs.rangeMax;
        enemyCanAttack = cs.enemyCanAttack;
        weaponReq      = cs.weaponReq;
        terrainReq     = new List <TerrainTile>();
        for (int i = 0; i < cs.terrainReq.Count; i++)
        {
            terrainReq.Add(cs.terrainReq[i]);
        }
    }
Ejemplo n.º 2
0
 public void ForEachSkills(SkillActivation activation, TacticsMove user, CharacterListVariable list)
 {
     for (int i = 0; i < skills.Length; i++)
     {
         if (!skills[i] || skills[i].activationType != activation)
         {
             continue;
         }
         skills[i].ForEachBoost(list, user);
     }
 }
Ejemplo n.º 3
0
 public void EndSkills(SkillActivation activation, TacticsMove user, TacticsMove enemy)
 {
     for (int i = 0; i < skills.Length; i++)
     {
         if (!skills[i] || skills[i].activationType != activation)
         {
             continue;
         }
         skills[i].EndSkill(user, enemy);
     }
 }
Ejemplo n.º 4
0
 public int EditValueSkills(SkillActivation activation, TacticsMove user, int value)
 {
     for (int i = 0; i < skills.Length; i++)
     {
         if (!skills[i] || skills[i].activationType != activation)
         {
             continue;
         }
         value = skills[i].EditValue(value, user);
     }
     return(value);
 }
Ejemplo n.º 5
0
    //Assign references
    protected void Assign()
    {
        //Assigning player components
        player          = gameObject; //Since the skills will be a component to the player
        playerHealth    = player.GetComponent <PlayerHealthMult> ();
        playerSkill     = player.GetComponent <PlayerSkillMult> ();
        playerMovement  = player.GetComponent <PlayerMovementMult> ();
        skillActivation = player.GetComponent <SkillActivation> ();

        button.image.sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite;
        button.GetComponent <Button> ().onClick.AddListener(() => {
            Activate();
        });                              //Assigning skill effect to the button
    }
Ejemplo n.º 6
0
 public void ForEachSkills(SkillActivation activation)
 {
     if (faction == Faction.PLAYER)
     {
         skills.ForEachSkills(activation, this, playerList);
     }
     else if (faction == Faction.ENEMY)
     {
         skills.ForEachSkills(activation, this, enemyList);
     }
     else if (faction == Faction.ALLY)
     {
         skills.ForEachSkills(activation, this, allyList);
     }
 }
 override public void FixedUpdate()
 {
     base.FixedUpdate();
     if (paused)
     {
         return;
     }
     if (activeCharacter == null)
     {
         float           highestInit = -1;
         SkillActivation nowSA       = null;
         foreach (SkillActivation sa in pendingSkillActivations)
         {
             if (sa.delay > highestInit)
             {
                 highestInit = sa.delay;
                 nowSA       = sa;
             }
         }
         if (order.Count > 0 && order[0].initiative > highestInit)
         {
             highestInit = order[0].initiative;
             nowSA       = null;
         }
         activeInitiative = highestInit;
         if (order.Count == 0)
         {
             EndRound();
         }
         else
         {
             if (nowSA == null)
             {
                 Initiative i = order[0];
                 order.RemoveAt(0);
                 Activate(i.character);
             }
             else
             {
                 nowSA.Apply();
                 pendingSkillActivations.Remove(nowSA);
             }
         }
     }
 }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        animator = transform.GetComponent <Animator>();
        Action resetCurrentSkill = () =>
        {
            currentSkill           = "NOSKILL";
            currentSkillActivation = null;
        };

        foreach (SkillActivation activation in skills)
        {
            activation.skill.onSkillCompleted(resetCurrentSkill);
            activation.skill.onSkillInterrupted(resetCurrentSkill);
        }
        view          = transform.GetComponent <PhotonView>();
        skillLauncher = transform.GetComponent <SkillLauncher>();
        player        = transform.GetComponent <PlayerManager>();
    }
Ejemplo n.º 9
0
    public override void ResetValues()
    {
        base.ResetValues();
        icon           = null;
        description    = "";
        activationType = SkillActivation.NONE;

        chance  = 0;
        percent = 0;
        value   = 0;
        boost   = new Boost();

        includeSelf    = false;
        range          = 0;
        rangeMax       = 0;
        enemyCanAttack = EnemyCanAttack.BOTH;
        weaponReq      = WeaponType.NONE;
        terrainReq     = new List <TerrainTile>();
    }
Ejemplo n.º 10
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log("animator state: " + animator.GetCurrentAnimatorStateInfo(0).fullPathHash);
        if (skillLauncher.waitingForServerResponse)
        {
            return;
        }
        if (!animator.GetCurrentAnimatorStateInfo(0).IsName("free") && !animator.GetCurrentAnimatorStateInfo(0).IsName("walk"))
        {
            return;
        }
        if (disableInput)
        {
            return;
        }
        foreach (SkillActivation activation in skills)
        {
            if (!Input.GetKey(activation.keyCode))
            {
                continue;
            }

            //Debug.Log("Activation: " + activation.keyCode);

            if (activation.skill.getLastFired() + activation.skill.getCooldown() > Time.time || player.gold < activation.skill.goldCost)
            {
                return;
            }

            player.gold           -= activation.skill.goldCost;
            currentSkill           = activation.skill.getName();
            currentSkillActivation = activation;
            skillLauncher.waitingForServerResponse = true;
            skillLauncher.photonView.RPC("launchSkill", PhotonTargets.AllViaServer, currentSkill);

            //activation.skill.fire();
            return;
        }
    }
Ejemplo n.º 11
0
    public override void FixedUpdate()
    {
        base.FixedUpdate();
        if (paused)
        {
            return;
        }
        //if there is no active unit
        if (activeCharacter == null)
        {
            //else, take the first unit or action with CT > 100, if any, and activate it
            for (int i = 0; i < pendingSkillActivations.Count; i++)
            {
                SkillActivation sa = pendingSkillActivations[i];
                if (sa.delayRemaining <= 0)
                {
                    sa.Apply();
                    pendingSkillActivations.RemoveAt(i);
                    //FIXME: need to prevent scheduler from
                    //fixedupdate-ing while skills are animating
                    return;
                }
            }
            foreach (Character c in characters)
            {
                float ct    = c.GetStat(ctStat);
                float maxCT = maxCTStat != null?
                              c.GetStat(maxCTStat, defaultMaxCT) :
                                  defaultMaxCT;

                if (ct >= maxCT)
                {
                    c.SetBaseStat(ctStat, maxCT);
                    Activate(c);
                    return;
                }
            }
            //and tick up CT on everything/body by their effective speed
            foreach (SkillActivation sa in pendingSkillActivations)
            {
                sa.delayRemaining =
                    sa.delayRemaining - sa.skill.GetParam(skillSpeedStat, defaultSkillSpeed);
            }
            foreach (Character c in characters)
            {
                //don't mess with jumpers' speed because speed is used in jump timing
                if (c.HasStatusEffect("jumping"))
                {
                    continue;
                }
                float speed = speedStat != null?
                              c.GetStat(speedStat, defaultSpeed) :
                                  defaultSpeed;

                c.AdjustBaseStat(ctStat, speed);
                foreach (StatusEffect se in c.StatusEffects)
                {
                    se.Tick(se.ticksInLocalTime ? speed : 1);
                }
            }
        }
        //otherwise, do nothing
    }
Ejemplo n.º 12
0
 public int EditValueSkills(SkillActivation activation, int value)
 {
     return(skills.EditValueSkills(activation, this, value));
 }
Ejemplo n.º 13
0
 public void EndSkills(SkillActivation activation, TacticsMove enemy)
 {
     skills.EndSkills(activation, this, enemy);
 }
Ejemplo n.º 14
0
 protected override void ExtraEntrySettings()
 {
     skillActivation = (SkillActivation)EditorGUILayout.EnumPopup("Skilltype", skillActivation);
 }