示例#1
0
    private void HandleAttack()
    {
        Vector3 attackDir = animatedWalker.GetLastMoveVector();

        if (Input.GetMouseButtonDown(0))
        {
            attackDir = (UtilsClass.GetMouseWorldPosition() - GetPosition()).normalized;
        }

        if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
        {
            // Attack
            SetStateBusy();

            EnemyHandler enemyHandler = EnemyHandler.GetClosestEnemy(GetPosition() + attackDir * 4f, 20f);
            if (enemyHandler != null)
            {
                enemyHandler.Damage(this);
                attackDir          = (enemyHandler.GetPosition() - GetPosition()).normalized;
                transform.position = enemyHandler.GetPosition() + attackDir * -12f;
            }
            else
            {
                transform.position = transform.position + attackDir * 4f;
            }

            /*
             * unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_PunchStartup"), attackDir, 2f, (UnitAnim unitAnim) => {
             *  unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack"), attackDir, 1f, (UnitAnim unitAnim2) => SetStateNormal(), null, null);
             * }, null, null);
             */

            UnitAnimType activeAnimType = unitAnimation.GetActiveAnimType();
            switch (activeAnimType.GetName())
            {
            default:
                unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_PunchQuick"), attackDir, 1f, (UnitAnim unitAnim2) => SetStateNormal(), null, null);
                break;

            case "dBareHands_PunchQuick":
                unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_KickQuick"), attackDir, 1f, (UnitAnim unitAnim2) => SetStateNormal(), null, null);
                break;
            }

            //unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack"), attackDir, 1f, (UnitAnim unitAnim2) => SetStateNormal(), null, null);

            /*
             * Transform swordSlashTransform = Instantiate(GameAssets.i.pfSwordSlash, GetPosition() + attackDir * 13f, Quaternion.Euler(0, 0, UtilsClass.GetAngleFromVector(attackDir)));
             * swordSlashTransform.GetComponent<SpriteAnimator>().onLoop = () => Destroy(swordSlashTransform.gameObject);
             *
             * UnitAnimType activeAnimType = unitAnimation.GetActiveAnimType();
             * if (activeAnimType == GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Sword) {
             *  swordSlashTransform.localScale = new Vector3(swordSlashTransform.localScale.x, swordSlashTransform.localScale.y * -1, swordSlashTransform.localScale.z);
             *  unitAnimation.PlayAnimForced(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Sword2, attackDir, 1f, (UnitAnim unitAnim) => SetStateNormal(), null, null);
             * } else {
             *  unitAnimation.PlayAnimForced(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Sword, attackDir, 1f, (UnitAnim unitAnim) => SetStateNormal(), null, null);
             * }
             */
        }
    }
示例#2
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        idleUnitAnim   = UnitAnimType.GetUnitAnimType("dMinion_Idle");
        walkUnitAnim   = UnitAnimType.GetUnitAnimType("dMinion_Walk");
        hitUnitAnim    = null;
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dMinion_Attack");

        idleUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Idle");
        walkUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Walk");
        hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_Punch");

        idleUnitAnim   = UnitAnimType.GetUnitAnimType("dMarine_Idle");
        walkUnitAnim   = UnitAnimType.GetUnitAnimType("dMarine_Walk");
        hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dMarine_Attack");

        //animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType("dMinion_Idle"), UnitAnimType.GetUnitAnimType("dMinion_Walk"), 1f, 1f);
        animatedWalker = new AnimatedWalker(unitAnimation, idleUnitAnim, walkUnitAnim, 1f, 1f);

        bodyTransform.GetComponent <MeshRenderer>().material = GameAssets.i.m_MarineSpriteSheet;
        //unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_AttackPose"), 1f, null, null, null);
        //state = State.Busy;

        //FunctionTimer.Create(StartAttackingPlayer, 1f);
    }
示例#3
0
    private void Awake()
    {
        vObject         = CreateBasicUnit(transform, GetPosition(), 30f, null);
        unitAnimation   = vObject.GetLogic <V_UnitAnimation>();
        unitSkeleton    = vObject.GetLogic <V_UnitSkeleton>();
        objectTransform = vObject.GetLogic <V_IObjectTransform>();

        UnitAnimType idleUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Idle");
        UnitAnimType walkUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Walk");
        UnitAnimType hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        UnitAnimType attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");

        canShoot = true;

        //unitSkeletonCompositeWeapon = new V_UnitSkeleton_Composite_Weapon(vObject, unitSkeleton, UnitAnim.GetUnitAnim("Aim_PistolRight"), UnitAnim.GetUnitAnim("Aim_PistolLeft"), UnitAnim.GetUnitAnim("Aim_PistolShootRight"), UnitAnim.GetUnitAnim("Aim_PistolShootLeft"));
        unitSkeletonCompositeWeapon = new V_UnitSkeleton_Composite_Weapon(vObject, unitSkeleton, UnitAnim.GetUnitAnim("dMarine_AimWeaponRight"), UnitAnim.GetUnitAnim("dMarine_AimWeaponLeft"), UnitAnim.GetUnitAnim("dMarine_ShootWeaponRight"), UnitAnim.GetUnitAnim("dMarine_ShootWeaponLeft"));
        //unitSkeletonCompositeWeapon = new V_UnitSkeleton_Composite_Weapon(vObject, unitSkeleton, UnitAnim.GetUnitAnim("Aim_ShotgunRight"), UnitAnim.GetUnitAnim("Aim_ShotgunLeft"), UnitAnim.GetUnitAnim("Aim_ShotgunShootRight"), UnitAnim.GetUnitAnim("Aim_ShotgunShootLeft"));
        vObject.AddRelatedObject(unitSkeletonCompositeWeapon);
        unitSkeletonCompositeWeapon.SetActive();

        unitSkeletonCompositeWalker_BodyHead = new V_UnitSkeleton_Composite_Walker(vObject, unitSkeleton, GameAssets.UnitAnimTypeEnum.dMarine_Walk, GameAssets.UnitAnimTypeEnum.dMarine_Idle, new[] { "Body", "Head" });
        vObject.AddRelatedObject(unitSkeletonCompositeWalker_BodyHead);

        unitSkeletonCompositeWalker_Feet = new V_UnitSkeleton_Composite_Walker(vObject, unitSkeleton, GameAssets.UnitAnimTypeEnum.dMarine_Walk, GameAssets.UnitAnimTypeEnum.dMarine_Idle, new[] { "FootL", "FootR" });
        vObject.AddRelatedObject(unitSkeletonCompositeWalker_Feet);
    }
    private void Start()
    {
        /*
         * Transform bodyTransform = transform.Find("Body");
         * unitSkeleton = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent<MeshFilter>().mesh = mesh);
         * unitAnimation = new V_UnitAnimation(unitSkeleton);
         */

        vObject         = CreateBasicUnit(transform, GetPosition(), 30f, null);
        unitAnimation   = vObject.GetLogic <V_UnitAnimation>();
        unitSkeleton    = vObject.GetLogic <V_UnitSkeleton>();
        objectTransform = vObject.GetLogic <V_IObjectTransform>();

        UnitAnimType idleUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Idle");
        UnitAnimType walkUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Walk");
        UnitAnimType hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        UnitAnimType attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");

        canShoot = true;

        unitSkeletonCompositeWeapon = new V_UnitSkeleton_Composite_Weapon(vObject, unitSkeleton, UnitAnim.GetUnitAnim("Aim_PistolRight"), UnitAnim.GetUnitAnim("Aim_PistolLeft"), UnitAnim.GetUnitAnim("Aim_PistolShootRight"), UnitAnim.GetUnitAnim("Aim_PistolShootLeft"));
        vObject.AddRelatedObject(unitSkeletonCompositeWeapon);
        unitSkeletonCompositeWeapon.SetActive();

        unitSkeletonCompositeWalker_BodyHead = new V_UnitSkeleton_Composite_Walker(vObject, unitSkeleton, GameAssets.UnitAnimTypeEnum.dMarine_Walk, GameAssets.UnitAnimTypeEnum.dMarine_Idle, new[] { "Body", "Head" });
        vObject.AddRelatedObject(unitSkeletonCompositeWalker_BodyHead);

        unitSkeletonCompositeWalker_Feet = new V_UnitSkeleton_Composite_Walker(vObject, unitSkeleton, GameAssets.UnitAnimTypeEnum.dMarine_Walk, GameAssets.UnitAnimTypeEnum.dMarine_Idle, new[] { "FootL", "FootR" });
        vObject.AddRelatedObject(unitSkeletonCompositeWalker_Feet);
    }
示例#5
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType("dMarine_Idle"), UnitAnimType.GetUnitAnimType("dMarine_Walk"), 1f, 1f);
    }
示例#6
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType(idleAnimation), UnitAnimType.GetUnitAnimType(walkAnimation), idleFrameRate, walkFrameRate);
    }
 public void PlayRollAnimation(Vector3 dir)
 {
     if (axis == Axis.XZ && dir.y == 0f)
     {
         dir = new Vector3(dir.x, dir.z);
     }
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_Roll"), dir, 1f, null, null, null);
 }
示例#8
0
 public void PlayHitAnimation(Vector3 dir, Action onAnimComplete)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_Hit"), dir, 1f, (UnitAnim unitAnim2) => {
         if (onAnimComplete != null)
         {
             onAnimComplete();
         }
     }, (string trigger) => {
     }, null);
 }
 static UnitAnimTypeEnum()
 {
     FieldInfo[] fieldInfoArr = typeof(UnitAnimTypeEnum).GetFields(BindingFlags.Static | BindingFlags.Public);
     foreach (FieldInfo fieldInfo in fieldInfoArr)
     {
         if (fieldInfo != null)
         {
             fieldInfo.SetValue(null, UnitAnimType.GetUnitAnimType(fieldInfo.Name));
         }
     }
 }
示例#10
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        idleUnitAnimType = UnitAnimType.GetUnitAnimType("dBareHands_Idle");

        unitAnimation.PlayAnim(idleUnitAnimType, new Vector3(0, -1), 1f, null, null, null);
    }
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType(idleAnimation), UnitAnimType.GetUnitAnimType(walkAnimation), idleFrameRate, walkFrameRate);
        state          = State.Waiting;
        waitTimer      = waitTimeList[0];
        lastMoveDir    = defaultAimDirection;
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dMarine_Attack");
    }
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        idleUnitAnim = UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle");
        walkUnitAnim = UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk");

        PlayIdleAnimation(new Vector3(0, -1));
    }
示例#13
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        UnitAnimType idleUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_Idle");
        UnitAnimType walkUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_Walk");
        UnitAnimType hitUnitAnim  = UnitAnimType.GetUnitAnimType("dBareHands_Hit");

        animatedWalker = new AnimatedWalker(unitAnimation, idleUnitAnim, walkUnitAnim, 1f, 1f);
    }
示例#14
0
    private void Awake()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        UnitAnimType idleUnitAnim   = UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle");
        UnitAnimType walkUnitAnim   = UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk");
        UnitAnimType hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        UnitAnimType attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");

        animatedWalker = new AnimatedWalker(unitAnimation, idleUnitAnim, walkUnitAnim, 1f, 1f);
    }
示例#15
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType(idleAnimation), UnitAnimType.GetUnitAnimType(walkAnimation), idleFrameRate, walkFrameRate);
        state          = State.Waiting;
        waitTimer      = waitTimeList[0];
        lastMoveDir    = aimDirection;
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dMarine_Attack");

        fieldOfView = Instantiate(pfFieldOfView, null).GetComponent <FieldOfView>();
        fieldOfView.SetFoV(fov);
        fieldOfView.SetViewDistance(viewDistance);
    }
        public static ECS_UnitAnimType ConvertVAnimToAnim(ECS_UnitAnimType.TypeEnum typeEnum)
        {
            UnitAnimType     unitAnimType    = UnitAnimType.GetUnitAnimType(typeEnum.ToString());
            ECS_UnitAnimType ecsUnitAnimType = new ECS_UnitAnimType(
                typeEnum,
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.Down)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.Up)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.Left)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.Right)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.DownLeft)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.DownRight)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.UpLeft)),
                ConvertVAnimToAnim(unitAnimType.GetUnitAnim(UnitAnim.AnimDir.UpRight))
                );

            return(ecsUnitAnimType);
        }
示例#17
0
    public void Setup(Character character)
    {
        this.character     = character;
        transform.position = character.position;
        healthSystem       = new HealthSystem(character.stats.healthMax);
        healthSystem.SetHealthAmount(character.stats.health);
        healthWorldBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(15, 2), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(10000, 11000), new World_Bar.Outline {
            color = Color.black, size = .6f
        });
        healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged;
        RefreshHealthBar();

        RefreshTexture();

        playerBase.GetAnimatedWalker().SetAnimations(UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle"), UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk"), 1f, .7f);

        OvermapHandler.GetInstance().OnOvermapStopped += NPCOvermap_OnOvermapStopped;
    }
示例#18
0
 public void PlayShootAnimation(Vector3 dir, Action <Vector3> onHit, Action onAnimComplete)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dMarine_Attack"), dir, 1f, (UnitAnim unitAnim2) => {
         if (onAnimComplete != null)
         {
             onAnimComplete();
         }
     }, (string trigger) => {
         /*foreach (string key in (unitSkeleton.GetSkeletonUpdater() as V_Skeleton_Updater).bodyPartNameAnimDic.Keys) {
          *  Debug.Log(key);
          * }*/
         Vector3 shootGunEndPointPosition = unitSkeleton.GetBodyPartPosition("MuzzleFlash");
         if (onHit != null)
         {
             onHit(shootGunEndPointPosition);
         }
     }, null);
 }
示例#19
0
    private void Awake()
    {
        vObject         = CreateBasicUnit(transform, GetPosition(), 30f, null);
        unitAnimation   = vObject.GetLogic <V_UnitAnimation>();
        unitSkeleton    = vObject.GetLogic <V_UnitSkeleton>();
        objectTransform = vObject.GetLogic <V_IObjectTransform>();

        UnitAnimType idleUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Idle");
        UnitAnimType walkUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Walk");
        UnitAnimType hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        UnitAnimType attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");

        unitSkeletonCompositeWalker_BodyHead = new V_UnitSkeleton_Composite_Walker(vObject, unitSkeleton, GameAssets.UnitAnimTypeEnum.dMarine_Walk, GameAssets.UnitAnimTypeEnum.dMarine_Idle, new[] { "Body", "Head" });
        vObject.AddRelatedObject(unitSkeletonCompositeWalker_BodyHead);

        unitSkeletonCompositeWalker_Feet = new V_UnitSkeleton_Composite_Walker(vObject, unitSkeleton, GameAssets.UnitAnimTypeEnum.dMarine_Walk, GameAssets.UnitAnimTypeEnum.dMarine_Idle, new[] { "FootL", "FootR" });
        vObject.AddRelatedObject(unitSkeletonCompositeWalker_Feet);
    }
示例#20
0
 public void PlayPunchAnimation(Vector3 dir, Action <Vector3> onHit, Action onAnimComplete)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_PunchQuick"), dir, 1f, (UnitAnim unitAnim2) => {
         if (onAnimComplete != null)
         {
             onAnimComplete();
         }
     }, (string trigger) => {
         // HIT = HandR
         // HIT2 = HandL
         string hitBodyPartName = trigger == "HIT" ? "HandR" : "HandL";
         Vector3 impactPosition = unitSkeleton.GetBodyPartPosition(hitBodyPartName);
         if (onHit != null)
         {
             onHit(impactPosition);
         }
     }, null);
 }
示例#21
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        idleUnitAnim   = GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Idle;
        walkUnitAnim   = GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Walk;
        hitUnitAnim    = null;
        attackUnitAnim = null;

        idleUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Idle");
        walkUnitAnim   = UnitAnimType.GetUnitAnimType("dBareHands_Walk");
        hitUnitAnim    = UnitAnimType.GetUnitAnimType("dBareHands_Hit");
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");

        animatedWalker = new AnimatedWalker(unitAnimation, idleUnitAnim, walkUnitAnim, 1f, .75f);

        state = State.Normal;
    }
 public void PlayKickAnimation(Vector3 dir, Action <Vector3> onHit, Action onAnimComplete)
 {
     if (axis == Axis.XZ && dir.y == 0f)
     {
         dir = new Vector3(dir.x, dir.z);
     }
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_KickQuick"), dir, 1f, (UnitAnim unitAnim2) => {
         if (onAnimComplete != null)
         {
             onAnimComplete();
         }
     }, (string trigger) => {
         // HIT = FootL
         // HIT2 = FootR
         string hitBodyPartName = trigger == "HIT" ? "FootL" : "FootR";
         Vector3 impactPosition = unitSkeleton.GetBodyPartPosition(hitBodyPartName);
         if (onHit != null)
         {
             onHit(impactPosition);
         }
     }, null);
 }
 public void PlayPunchSlowAnimation(Vector3 dir, Action <Vector3> onHit, Action onAnimComplete, float frameRateMod = 1f)
 {
     if (axis == Axis.XZ && dir.y == 0f)
     {
         dir = new Vector3(dir.x, dir.z);
     }
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_Punch"), dir, 1f, (UnitAnim unitAnim2) => {
         if (onAnimComplete != null)
         {
             onAnimComplete();
         }
     }, (string trigger) => {
         // HIT = HandR
         // HIT2 = HandL
         string hitBodyPartName = trigger == "HIT" ? "HandR" : "HandL";
         Vector3 impactPosition = unitSkeleton.GetBodyPartPosition(hitBodyPartName);
         if (onHit != null)
         {
             onHit(impactPosition);
         }
     }, null);
 }
 public void SetAnimsBareHands()
 {
     animatedWalker.SetAnimations(UnitAnimType.GetUnitAnimType("dBareHands_Idle"), UnitAnimType.GetUnitAnimType("dBareHands_Walk"), 1f, 1f);
     attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");
 }
 public void SetAnimsSwordTwoHandedBack()
 {
     animatedWalker.SetAnimations(UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle"), UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk"), 1f, 1f);
     attackUnitAnim = UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Sword");
 }
 public void SetAnimsSwordShield()
 {
     animatedWalker.SetAnimations(UnitAnimType.GetUnitAnimType("dSwordShield_Idle"), UnitAnimType.GetUnitAnimType("dSwordShield_Walk"), 1f, 1f);
     attackUnitAnim = UnitAnimType.GetUnitAnimType("dSwordShield_Attack");
 }
示例#27
0
 public void PlayDodgeAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dSwordShield_Roll"), dir, 1f, null, null, null);
 }
示例#28
0
 public void PlaySlidingAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("Spiderman_Sliding"), dir, 1f, null, null, null);
 }
示例#29
0
 public void PlayWebZipShootAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("Spiderman_ShootWebZip"), dir, 1f, null, null, null);
 }
示例#30
0
 public void PlayRollAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_Roll"), dir, 1f, null, null, null);
 }