void OnClickAssign(SkillButton skill_button)
    {
        ActiveSkill active_skill = (ActiveSkill)skill_button.Skill;

        if (ActiveSkill != null && ActiveSkill.RealTime_CD != 0)
        {
            RedNotification.Push(RedNotification.Type.ON_CD);
            return;
        }
        foreach (ActiveSkillButtonController ASBC in OtherASBCs)
        {
            if (ASBC.ActiveSkill != null && ASBC.ActiveSkill.Name == active_skill.Name)
            {
                if (ASBC.ActiveSkill.RealTime_CD != 0)
                {
                    RedNotification.Push(RedNotification.Type.ON_CD);
                    return;
                }
                ASBC.DiscardSkill();
            }
        }
        MPC.SetActiveSkillAt(Slot, active_skill);
        FetchSkill();
        DisableActiveSlotsAssigning();
        skill_button.SkillSubMenu.TurnOff();
    }
 public void OnClickEquip()
 {
     if (!MPC.GetInventoryItem(Slot).isNull)
     {
         if (MPC.Compatible(E))
         {
             if (!MPC.GetEquippedItem(E.EquipType).isNull)  //Has Equipped Item
             {
                 Equipment TakeOff = MPC.GetEquippedItem(E.EquipType);
                 MPC.UnEquip(TakeOff.EquipType);
                 MPC.Equip(E);
                 transform.parent.parent.Find("EquippedSlotButtons/" + (int)E.EquipType).GetComponent <EquippedButtonController>().UpdateSlot();
                 MPC.RemoveFromInventory(Slot);
                 MPC.AddToInventory(Slot, TakeOff);
                 UpdateSlot();
                 EI.Show(E, EquipmentInfo.Mode.Inventory);
             }
             else    //No Equipped Item
             {
                 MPC.Equip(E);
                 transform.parent.parent.Find("EquippedSlotButtons/" + (int)E.EquipType).GetComponent <EquippedButtonController>().UpdateSlot();
                 MPC.RemoveFromInventory(Slot);
                 UpdateSlot();
                 EI.Show(E, EquipmentInfo.Mode.Inventory);
             }
         }
         else
         {
             RedNotification.Push(RedNotification.Type.CANT_EQUIP);
         }
     }
 }
示例#3
0
 //These two function will be deleted
 protected void NetworkControlUpdate()
 {
     if (Stunned || !Alive)
     {
         AttackVector = Vector2.zero;
         MoveVector   = Vector2.zero;
     }
     else if (Casting)
     {
         AttackVector = Vector2.zero;
         MoveVector   = Vector2.zero;
         Direction    = ControllerManager.Direction;
     }
     else
     {
         if (GetWC() != null && GetCurrStats(STATSTYPE.ESSENSE) - GetWC().EssenseCost < 0)
         {
             if (AttackVector != Vector2.zero)
             {
                 Client.Send(Protocols.UpdatePlayerAttackVector, new AttackData(Client.ClientID, Vector2.zero));
                 AttackVector          = Vector2.zero;
                 ExpectingAttackVector = true;
             }
             if (ControllerManager.AttackVector != Vector2.zero)
             {
                 RedNotification.Push(RedNotification.Type.NO_MANA);
             }
         }
         else
         {
             if (!ExpectingAttackVector && AttackVector != Raw(ControllerManager.AttackVector))
             {
                 Client.Send(Protocols.UpdatePlayerAttackVector, new AttackData(Client.ClientID, Raw(ControllerManager.AttackVector)));
                 ExpectingAttackVector = true;
             }
         }
         if (HasForce())
         {
             MoveVector = Vector2.zero;
         }
         else
         {
             if (!ExpectingMoveVector && MoveVector != ControllerManager.MoveVector)
             {
                 Client.Send(Protocols.UpdatePlayerMoveVector, new MovementData(Client.ClientID, ControllerManager.MoveVector));
                 ExpectingMoveVector = true;
             }
         }
         if (!ExpectingDirection && Direction != ControllerManager.Direction)
         {
             Client.Send(Protocols.UpdatePlayerDirection, new DirectionData(Client.ClientID, ControllerManager.Direction));
             ExpectingDirection = true;
         }
     }
 }
示例#4
0
 public void Assign()
 {
     if (Skill.lvl <= 0)
     {
         RedNotification.Push(RedNotification.Type.SKILL_NOT_LEARNED);
     }
     else
     {
         EnableActiveSlotsAssigning();
     }
 }
 public override void Interact()
 {
     if (CacheManager.MP.InventoryIsFull())
     {
         RedNotification.Push(RedNotification.Type.INVENTORY_FULL);
     }
     else
     {
         CacheManager.MP.AddToInventory(CacheManager.MP.FirstAvailbleInventorySlot, GetComponentInParent <EquipmentController>().E);
         CacheManager.MP.InteractTarget = null;
         Destroy(transform.parent.gameObject);
     }
 }
示例#6
0
 public bool Ready()
 {
     if (OC.Stunned)
     {
         RedNotification.Push(RedNotification.Type.STUNNED);
         return(false);
     }
     else if (RealTime_CD > 0)
     {
         RedNotification.Push(RedNotification.Type.ON_CD);
         return(false);
     }
     else if (OC.GetCurrStats(STATSTYPE.ESSENSE) - EssenseCost < 0)
     {
         RedNotification.Push(RedNotification.Type.NO_MANA);
         return(false);
     }
     return(true);
 }
 public void OnClickUnEquip()
 {
     if (!MPC.GetEquippedItem(Slot).isNull)
     {
         if (MPC.InventoryIsFull())  //Inventory Full
         {
             RedNotification.Push(RedNotification.Type.INVENTORY_FULL);
             return;
         }
         else
         {
             int SlotIndex = MPC.FirstAvailbleInventorySlot;
             MPC.AddToInventory(SlotIndex, E);
             transform.parent.parent.Find("InventoryButtons/" + SlotIndex).GetComponent <InventoryButtonController>().UpdateSlot();
             MPC.UnEquip(Slot);
             UpdateSlot();
             EI.Show(E, EquipmentInfo.Mode.Equipped);
         }
     }
 }
示例#8
0
 protected void SinglePlayerControlUpdate()  //Single player
 {
     if (Stunned || !Alive)
     {
         AttackVector = Vector2.zero;
         MoveVector   = Vector2.zero;
     }
     else if (Casting)
     {
         AttackVector = Vector2.zero;
         MoveVector   = Vector2.zero;
         Direction    = ControllerManager.Direction;
     }
     else
     {
         if (GetWC() != null && GetCurrStats(STATSTYPE.ESSENSE) - GetWC().EssenseCost < 0)
         {
             AttackVector = Vector2.zero;
             if (ControllerManager.AttackVector != Vector2.zero)
             {
                 RedNotification.Push(RedNotification.Type.NO_MANA);
             }
         }
         else
         {
             AttackVector = ControllerManager.AttackVector;
         }
         if (HasForce())
         {
             MoveVector = Vector2.zero;
         }
         else
         {
             MoveVector = ControllerManager.MoveVector;
         }
         Direction = ControllerManager.Direction;
     }
 }
示例#9
0
 public void LvlUp()
 {
     if (MPC.GetAvailableSkillPoints() <= 0)
     {
         RedNotification.Push(RedNotification.Type.NO_SKILL_POINT);
     }
     else if (!MeetRequirement())
     {
         RedNotification.Push(RedNotification.Type.SKILL_REQUIREMENT_NOT_MET);
     }
     else if (Skill != null && Skill.lvl == 5)
     {
         RedNotification.Push(RedNotification.Type.MAX_SKILL_LVL);
     }
     else
     {
         MPC.LvlUpSkill(SkillIndex);
         FetchSkill();
         FetechActiveSlotSkills();
         SkillSubMenu.TurnOff();
         AudioSource.PlayClipAtPoint(skill_lvlup, transform.position, GameManager.SFX_Volume);
     }
 }