Beispiel #1
0
 public void UnSheathWeapon(EWeapon Type, int LeftRight, bool Dual = false)
 {
     //Desenvainar arma
     ControllerComponent.InputMode = InputMode.None;
     AnimatorComponent.SetTrigger("WeaponUnsheathTrigger");
     SheathWeaponSwitch(EWeapon.Relax, Type, LeftRight, Dual, true);
     ControllerComponent.InputMode = InputMode.Game;
     State = 1;
 }
Beispiel #2
0
 public void SheathWeapon(EWeapon To, int LeftRight, bool Dual = false)
 {
     //Envainar arma
     ControllerComponent.InputMode = InputMode.None;
     AnimatorComponent.SetTrigger("WeaponSheathTrigger");
     SheathWeaponSwitch(WeaponState, To, LeftRight, Dual, true);
     ControllerComponent.InputMode = InputMode.Game;
     State = 0;
 }
Beispiel #3
0
 void InstantSheathWeaponSwitch(EWeapon Weapon)
 {
     if (AnimatorComponent)
     {
         int WeaponNumber = (int)Weapon;
         AnimatorComponent.SetTrigger("InstantSwitchTrigger");
         AnimatorComponent.SetInteger("Weapon", WeaponNumber);
     }
 }
Beispiel #4
0
    // Update is called once per frame
    void EquipWeapon(EWeapon eWeapon)
    {
        eCurrentWeapon = eWeapon;
        switch (eWeapon)
        {
        case EWeapon.ROCKBLASTER:
            currentWeapon = GetComponent<RockBlaster>();
            break;
        case EWeapon.GOLDMELTER:
            currentWeapon = GetComponent<GoldMelter>();
            break;
        case EWeapon.ICECRUSHER:
            currentWeapon = GetComponent<IceCrusher>();
            break;
        case EWeapon.NONE:
        default:
            break;

        }
    }
Beispiel #5
0
 public ThorAdapter(EWeapon eWeapon)
 {
     thor         = new Thor();
     this.eWeapon = eWeapon;
 }
Beispiel #6
0
    public void Block(bool NewBlock, EWeapon Weapon, int LR)
    {
        Blocking = NewBlock;
        if (Weapon == EWeapon.Relax)
        {
            State = (State == 2) ? 0 : State;
            return;
        }

        if (AnimatorComponent)
        {
            bool ShieldState  = AnimatorComponent.GetBool("Shield");
            int  LeftRight    = AnimatorComponent.GetInteger("LeftRight");
            int  WeaponNumber = AnimatorComponent.GetInteger("Weapon");

            AnimatorComponent.SetTrigger("BlockTrigger");
            State       = Mathf.Clamp(State, -1, int.MaxValue);
            LeftRight   = LR;
            ShieldState = (LR <= 0) ? true : ShieldState;

            switch (Weapon)
            {
            case EWeapon.Relax:
                LeftRight    = 0;
                ShieldState  = false;
                WeaponNumber = (int)EWeapon.Relax;
                Blocking     = false;
                break;

            case EWeapon.Unarmed:
                break;

            case EWeapon.LeftDagger:
            case EWeapon.LeftItem:
            case EWeapon.LeftMace:
            case EWeapon.LeftSword:
                WeaponNumber = (int)EWeapon.Armed;
                LeftRight    = 1;
                ShieldState  = false;
                break;

            case EWeapon.RightDagger:
            case EWeapon.RightItem:
            case EWeapon.RightMace:
            case EWeapon.RightSword:
            case EWeapon.RightSpear:
                WeaponNumber = (int)EWeapon.Armed;
                LeftRight    = 2;
                ShieldState  = false;
                break;

            default:
                WeaponNumber = (int)Weapon;
                break;
            }

            AnimatorComponent.SetBool("Shield", ShieldState);
            AnimatorComponent.SetInteger("Weapon", WeaponNumber);
            AnimatorComponent.SetInteger("LeftRight", LeftRight);
            AnimatorComponent.SetBool("Blocking", Blocking);
            State = (Blocking) ? 2 : State;
        }
    }
Beispiel #7
0
    public void Attack(EWeapon Type, int Value, bool Dual = false)
    {
        if (AttackState >= 1)
        {
            AttackState = -1;
            string   Name = "";
            int      WeaponNumber = (int)Type, HalfMaxValue;
            string[] AnimationClipName = new string [2];
            int      AttackValue = 0, MaxValue = 0;

            int OldLeft = AnimatorComponent.GetInteger("LeftWeapon");
            int OldRight = AnimatorComponent.GetInteger("RightWeapon");
            switch (Type)
            {
            case EWeapon.Relax:
                Name        = "";
                MaxValue    = 0;
                AttackValue = 1;
                AttackValues((int)EWeapon.Relax, 0, -1, -1);
                break;

            case EWeapon.Unarmed:
                Name                  = "Unarmed";
                MaxValue              = 6;
                AttackValue           = Value;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AnimationClipName [1] = (AttackValue <= 3) ? "-L" + Value : "-R" + Value;
                AnimatorComponent.SetInteger("Weapon", -1);
                AnimatorComponent.SetInteger("LeftWeapon", (int)EWeapon.Unarmed);
                AnimatorComponent.SetInteger("RightWeapon", (int)EWeapon.Unarmed);
                break;

            case EWeapon.LeftDagger:
                Name                  = "Dagger";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value;
                AnimationClipName [1] = "-L" + Value;
                AttackValues((int)EWeapon.Armed, 1, WeaponNumber, OldRight);
                break;

            case EWeapon.LeftItem:
                Name                  = "Item";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value;
                AnimationClipName [1] = "-L" + Value;
                AttackValues((int)EWeapon.Armed, 1, WeaponNumber, OldRight);
                break;

            case EWeapon.LeftMace:
                Name                  = "Mace";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value;
                AnimationClipName [1] = "-L" + Value;
                AttackValues((int)EWeapon.Armed, 1, WeaponNumber, OldRight);
                break;

            case EWeapon.LeftPistol:
                Name                  = "Pistol";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value;
                AnimationClipName [1] = "-L" + Value;
                AttackValues((int)EWeapon.Armed, 1, WeaponNumber, OldRight);
                break;

            case EWeapon.LeftSword:
                Name                  = "Sword";
                MaxValue              = 14;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value;
                AnimationClipName [1] = "-L" + Value;
                AttackValues((int)EWeapon.Armed, 1, WeaponNumber, OldRight);
                break;

            case EWeapon.RightDagger:
                Name                  = "Dagger";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value + HalfMaxValue;
                AnimationClipName [1] = "-R" + Value;
                AttackValues((int)EWeapon.Armed, 2, OldLeft, WeaponNumber);
                break;

            case EWeapon.RightItem:
                Name                  = "Item";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value + HalfMaxValue;
                AnimationClipName [1] = "-R" + Value;
                AttackValues((int)EWeapon.Armed, 2, OldLeft, WeaponNumber);
                break;

            case EWeapon.RightMace:
                Name                  = "Mace";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value + HalfMaxValue;
                AnimationClipName [1] = "-R" + Value;
                AttackValues((int)EWeapon.Armed, 2, OldLeft, WeaponNumber);
                break;

            case EWeapon.RightPistol:
                Name                  = "Pistol";
                MaxValue              = 6;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value + HalfMaxValue;
                AnimationClipName [1] = "-R" + Value;
                AttackValues((int)EWeapon.Armed, 2, OldLeft, WeaponNumber);
                break;

            case EWeapon.RightSpear:
                Name                  = "Spear";
                MaxValue              = 14;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value + HalfMaxValue;
                AnimationClipName [1] = "-R" + Value;
                AttackValues((int)EWeapon.Armed, 2, OldLeft, WeaponNumber);
                break;

            case EWeapon.RightSword:
                Name                  = "Sword";
                MaxValue              = 14;
                HalfMaxValue          = Mathf.RoundToInt(MaxValue / 2);
                Value                 = (Value > HalfMaxValue) ? Value - HalfMaxValue : Value;
                AttackValue           = Value + HalfMaxValue;
                AnimationClipName [1] = "-R" + Value;
                AttackValues((int)EWeapon.Armed, 2, OldLeft, WeaponNumber);
                break;

            case EWeapon.Armed:
                //AnimatorComponent.SetBool ("Shield", Shield);
                break;

            default:
                AttackValue           = Value;
                AnimationClipName [1] = System.Convert.ToString(Value);
                AnimatorComponent.SetInteger("Weapon", WeaponNumber);
                break;
            }

            AnimationClipName [0] = Name + "-Attack";
            string AttackDual   = "AttackDual" + AttackValue + "Trigger";
            string AttackSimple = "Attack" + AttackValue + "Trigger";
            string AttackName   = (Dual) ? AttackDual : AttackSimple;
            AnimatorComponent.SetTrigger(AttackName);

            float         AttackLength = 0.0f;
            AnimationClip Temp         = GetAnimationClip(AnimationClipName[0] + AnimationClipName[1]);
            if (Temp != null)
            {
                AttackLength = Temp.length;
            }
            Invoke("OnAttack", AttackLength / SpeedMultiplier);
        }
    }
Beispiel #8
0
    void SheathWeaponSwitch(EWeapon From, EWeapon To, int LR, bool Dual, bool Safe)
    {
        int SheathLocation = Mathf.Clamp((int)SheathType, 0, 1);
        int LeftRight      = (Dual) ? 3 : LR;
        int WeaponNumber   = (int)From;
        int WeaponSwitch   = (int)To;

        if (Safe)
        {
            switch (To)
            {
            //Relax:
            case EWeapon.Relax:
                WeaponSwitch = (int)EWeapon.Relax;
                break;

            //Unarmed:
            case EWeapon.Unarmed:
                SheathLocation = -1;
                WeaponNumber   = -1;
                WeaponSwitch   = -1;
                break;

            //AllRightLeft:
            case EWeapon.LeftRightAll:
                LeftRight = Mathf.Clamp(LeftRight, 1, 2);
                break;

            //Two Handed:
            case EWeapon.TwoHandAxe:
            case EWeapon.TwoHandClub:
            case EWeapon.TwoHandSpear:
            case EWeapon.TwoHandStaff:
            case EWeapon.TwoHandSword:
                WeaponSwitch = (int)EWeapon.Armed;
                LeftRight    = Mathf.Clamp(LeftRight, 1, 3);
                break;

            //Left Handed:
            case EWeapon.LeftItem:
            case EWeapon.LeftDagger:
            case EWeapon.LeftMace:
            case EWeapon.LeftPistol:
            case EWeapon.LeftSword:
                WeaponSwitch = (int)EWeapon.Armed;
                LeftRight    = 1;
                break;

            //Right Handed:
            case EWeapon.RightItem:
            case EWeapon.RightDagger:
            case EWeapon.RightMace:
            case EWeapon.RightPistol:
            case EWeapon.RightSword:
                WeaponSwitch = (int)EWeapon.Armed;
                LeftRight    = 2;
                break;

            default: break;
            }
        }
        WeaponState = (EWeapon)WeaponSwitch;
        SheathWeaponValues(WeaponNumber, WeaponSwitch, SheathLocation, LeftRight);
    }
 public Attackable(EWeapon pType, int pDamage)
 {
     type       = pType;
     _maxDamage = pDamage;
 }