Exemple #1
0
    public void Reload(Vector3 aimTargetPosition, Action onReloadCompleted)
    {
        SetAimTarget(aimTargetPosition);
        Action <V_Skeleton_Anim> reloadCompleted = (V_Skeleton_Anim skeletonAnim) => {
            isReloading = false;
            activeAnimAimWeaponReload.GetAnims()[0].onAnimComplete = null;
            //CodeMonkey.CMDebug.TextPopupMouse("reload");
            onReloadCompleted();
        };

        isReloading = true;
        activeAnimAimWeaponReload.ResetAnims();
        activeAnimAimWeaponReload.GetAnims()[0].onAnimComplete = reloadCompleted;
        unitSkeleton.ReplaceAllBodyPartsInAnimation(activeAnimAimWeaponReload);
    }
Exemple #2
0
    public void Shoot(Vector3 aimDir, Action onShootCompleted)
    {
        SetAimTarget(aimDir);

        Action <V_Skeleton_Anim> shootCompleted = (V_Skeleton_Anim skeletonAnim) => {
            activeAnimShootWeapon.GetAnims()[0].onAnimComplete = null;
            isShooting = false;
            unitSkeleton.ReplaceAllBodyPartsInAnimation(activeAnimAimWeapon);
            onShootCompleted();
        };

        activeAnimShootWeapon.ResetAnims();
        activeAnimShootWeapon.GetAnims()[0].onAnimComplete = shootCompleted;
        unitSkeleton.ReplaceAllBodyPartsInAnimation(activeAnimShootWeapon);
        isShooting = true;
    }
        private static ECS_UnitAnim ConvertVAnimToAnim(UnitAnim unitAnim)
        {
            List <ECS_Skeleton_Anim> skeletonAnimList = new List <ECS_Skeleton_Anim>();

            foreach (V_Skeleton_Anim vSkeletonAnim in unitAnim.GetAnims())
            {
                skeletonAnimList.Add(ConvertVAnimToAnim(vSkeletonAnim));
            }
            return(new ECS_UnitAnim {
                anims = skeletonAnimList.ToArray()
            });
        }
        private static bool DoesUnitAnimHaveConstantFrameCount(UnitAnim unitAnim)
        {
            V_Skeleton_Anim[] anims = unitAnim.GetAnims();
            int firstFrameCount     = anims[0].frames.Length;

            for (int i = 1; i < anims.Length; i++)
            {
                if (anims[i].frames.Length != firstFrameCount)
                {
                    return(false);
                }
            }

            return(true);
        }