Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     m_RootRef = gameObject;
     m_TransformRef = new TransformCache(m_RootRef.transform);
     m_ScaleFactor = (-m_RootRef.transform.localScale.x) / m_RootRef.transform.localScale.x;
     m_State = AnimationState.Idle;
 }
Ejemplo n.º 2
0
 void OnEnable()
 {
     MyAnimation = MyTransform.GetComponent<Animation>();
     MyAnimation.wrapMode = MyWarpMode;
     MyAnimationState = MyAnimation[MyAnimation.animation.clip.name];
     MyAnimationStateTime = 0.0f;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor that specifies a starting state for the animation
 /// </summary>
 /// <param name="startingState">Only Showing or Hiding should be used</param>
 public Animator(UserControl animateControl, AnimationState startingState)
 {
     InitializeTimer();
     animatedControl = animateControl;
     state = startingState;
     tmrAnimate.Start();
 }
Ejemplo n.º 4
0
 public void ChangeAnimationState(AnimationState _NextState, float _DelayTime, bool _RestoreTransform = false)
 {
     if (m_NextState != _NextState) {
         m_NextState = _NextState;
         StartCoroutine(PerformChangeAnimationState(_NextState, _DelayTime, _RestoreTransform));
     }
 }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     lastPosition = transform.position;
     walk = animation["walk"];
     walk.enabled = true;
     walk.weight = 0;
 }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        animation.Stop();

        // By default loop all animations
        animation.wrapMode = WrapMode.Loop;

        // Jump animation are in a higher layer:
        // Thus when a jump animation is playing it will automatically override all other animations until it is faded out.
        // This simplifies the animation script because we can just keep playing the walk / run / idle cycle without having to spcial case jumping animations.
        int jumpingLayer = 1;
        AnimationState jump = animation["jump"];
        jump.layer = jumpingLayer;
        jump.speed *= jumpAnimationSpeedModifier;
        jump.wrapMode = WrapMode.Once;

        AnimationState jumpFall = animation["jumpFall"];
        jumpFall.layer = jumpingLayer;
        jumpFall.wrapMode = WrapMode.ClampForever;

        AnimationState jumpLand = animation["jumpLand"];
        jumpLand.layer = jumpingLayer;
        jumpLand.speed *= jumpLandAnimationSpeedModifier;
        jumpLand.wrapMode = WrapMode.Once;

        //AnimationState buttStomp = animation["buttStomp"];

        run = animation["run"];
        run.speed *= runAnimationSpeedModifier;

        AnimationState walk = animation["walk"];
        walk.speed *= walkAnimationSpeedModifier;
    }
 // Run as the scene is initializing
 void Awake()
 {
     player = GameObject.FindWithTag("Player");
     playerStart = GameObject.Find ("PlayerStart");
     door = GameObject.FindWithTag("BedroomDoor");
     cinematic = player.animation["Beginning_Cinematic"];
 }
Ejemplo n.º 8
0
        public virtual void Update(GameTime gameTime)
        {
            //_Sprite.Update(gameTime);

            if (_AnimationState == AnimationState.Waiting)
            {
                if (_AnimationDelayCount >= _AnimationDelayInterval)
                    PreAnimation();
            }
            else if (_AnimationState == AnimationState.Animate)
            {
                StartSiblingAnimations(FireTime.AtStart);
                if (_AnimationDelayCount < _AnimationDelayInterval)
                    _AnimationDelayCount += gameTime.ElapsedGameTime.Milliseconds;
                else
                {
                    if (_AnimationCount < _AnimationInterval)
                    {
                        _AnimationCount = MathHelper.Clamp(_AnimationCount + gameTime.ElapsedGameTime.Milliseconds, 0, _AnimationInterval);
                        AnimationLogic();
                    }
                    else
                    {
                        PostAnimation();
                        _AnimationState = AnimationState.End;
                        StartSiblingAnimations(FireTime.AtEnd);
                    }
                }
            }
        }
Ejemplo n.º 9
0
	// Use this for initialization
	void Start () {
		lat = animation[lateralClip.name];
		vert = animation[verticalClip.name];
		lat.layer = 1;
		vert.layer = 2;
		lat.speed = 0;
		vert.speed = 0;
		lat.blendMode = AnimationBlendMode.Blend;
		vert.blendMode = AnimationBlendMode.Additive;
		lat.enabled = true;
		vert.enabled = true;
		animation.Play(lat.name);
		animation.Play(vert.name);
		
		// we have to sample the frames to determine the min and max extent in each direction
		lat.time = 0;
		vert.time = 0;
		animation.Sample();
		minOffset = endpoint.position;
		lat.normalizedTime = 1;
		vert.normalizedTime = 1;
		animation.Sample();
		maxOffset = endpoint.position;
		vertMin = minOffset.y;
		minOffset.y = startpoint.position.y;
		float maxY = maxOffset.y;
		maxOffset.y = startpoint.position.y;
		latMin = Vector3.Distance(startpoint.position, minOffset);
//		float maxRange = Vector3.Distance(startpoint.position, maxOffset);
		latScale = 1.0f/(Vector3.Distance(minOffset, maxOffset)); // so time = scale * (range-min);
		vertScale = 1.0f/(maxY - vertMin);
	}
Ejemplo n.º 10
0
 void Update()
 {
     if (Input.GetButton("Fire3"))
     {
         animationState = AnimationState.Falling;
     }
     switch (animationState)
     {
         case AnimationState.NotAnimated:
             break;
         case AnimationState.Falling:
             FallDown();
             break;
         case AnimationState.LayingDown:
             float vertical = CrossPlatformInputManager.GetAxis("Vertical");
             if (vertical != 0)
             {
                 animationState = AnimationState.GettingUp;
             }
             break;
         case AnimationState.GettingUp:
             GetUp();
             break;
         default:
             break;
     }
 }
Ejemplo n.º 11
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetAxis("Horizontal")>0)
     {
         animationState=AnimationState.walkRight;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     else if (Input.GetAxis("Horizontal")<0)
     {
         animationState=AnimationState.walkLeft;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     else if (Input.GetAxis("Vertical")>0)
     {
         animationState=AnimationState.walkBack;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     else if (Input.GetAxis("Vertical")<0)
     {
         animationState=AnimationState.walkFront;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     if (startIdleTime)
     {
         UpdateToIdleAnimations();
     }
     UpdateAnimation();
 }
Ejemplo n.º 12
0
    public void OnStateAnimationChange(AnimationState previousState, AnimationState actualState)
    {
        bool change = false;
        switch (actualState) {
            case AnimationState.WALK:
            case AnimationState.CHASE:
            case AnimationState.RUN_AWAY:
                if (settedFX) break;
                settedFX = true;
                change = true;
                break;

            default:
                if (!settedFX) break;
                settedFX = false;
                change = true;
                break;
        }

        if (change) {
            foreach (ParticleSystem system in walkingFX.GetComponentsInChildren<ParticleSystem>()) {
                ParticleSystem.EmissionModule emission = system.emission;
                emission.enabled = settedFX;
            }
        }
    }
Ejemplo n.º 13
0
 public void Start()
 {
     animState = animation[animation.clip.name];
     animState.speed = 0;
     fogColor = RenderSettings.fogColor;
     ambientLight = RenderSettings.ambientLight;
 }
Ejemplo n.º 14
0
 protected void Initialise()
 {
     // The Animation Controller feeds on AnimationStates. You've got to assign your animations to variables so that you can call them from the controller
     //
     GetComponent<Animation>()["Attack1"].speed = 2.0f;
     GetComponent<Animation>()["Attack2"].speed = 2.0f;
     //
     //
     animationAttack1Anticipation = GetComponent<Animation>()["Attack1Anticipation"];
     animationAttack1 = GetComponent<Animation>()["Attack1"];
     //
     animationAttack2Anticipation = GetComponent<Animation>()["Attack2Anticipation"];
     animationAttack2 = GetComponent<Animation>()["Attack2"];
     animationAttack3 = GetComponent<Animation>()["WhirlwindAttack"];
     //
     animationWhirlwind = GetComponent<Animation>()["Whirlwind"];
     animationIdle = GetComponent<Animation>()["Idle"];
     animationIdle.speed = 0.4f;
     animationRespawn = GetComponent<Animation>()["Resurection"];
     animationRespawn.speed = 0.8f;
     animationAttack3.speed = 0.8f;
     //
     leftSwipe.SetTime (0.0f, 0, 1);
     rightSwipe.SetTime (0.0f, 0, 1);
     //
 }
Ejemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     mOctopusAnim = GetComponent<Animator>();
     mOctopusAnim.SetFloat(mBlendTree, 1.0f);
     mRandomRange = Random.Range(minAttackTime, maxAttackTime);
     mAnimState = AnimationState.Idle;
 }
Ejemplo n.º 16
0
 public void Start () {
     anim = GetComponent<Animation>();
     animState = anim[anim.clip.name];
     // reset effects
     percent = 0;
     Sample();
 }
Ejemplo n.º 17
0
    //    
    public void CrossfadeAnimation(AnimationState state, float fadeTime)
    {
        // ** This function is exactly like the Unity Animation.Crossfade() method
        //
        if (currentState == state)
            return;
        animationFadeTime = fadeTime;

        for (int i = 0; i < fadingStates.Count; i++) {
            if (state.name == fadingStates[i].name) {
                fadingStates.RemoveAt (i);
                if (currentState != null)
                    fadingStates.Add (currentState);
                currentState = state;
                return;
            }
        }
        //
        if (currentState != null)
            fadingStates.Add (currentState);
        //
        currentState = state;
        currentState.weight = 0;
        currentState.time = currentStateTime = 0;
        currentState.enabled = true;
        //
    }
Ejemplo n.º 18
0
	void Start()
	{
		if (Timer == null) Timer = GetComponent<CountdownTimer>();
		if (Timer == null) 
		{
			enabled = false;
			return;
		}
		
		if (Target == null) Target = animation;
		if (Target == null) 
		{
			enabled = false;
			return;
		}
		
		cl = animation.GetClip(AnimationName);
		if (cl == null) 
		{
			Debug.LogError("Animation " + AnimationName + " not found on object");
			return;
		}
		
		if (!Blend)
		{
			animation.Play(AnimationName);
		}
		else
		{
			animation.Blend(AnimationName, BlendWeight, 0f);
		}
		
		st = animation[AnimationName];
		st.speed = 0;
	}
Ejemplo n.º 19
0
 public void GetAnimationState(Entity entity)
 {
     Entity = entity;
     State = Entity.GetAnimationState(StateName);
     State.Loop = Loop;
     State.Weight = 0;
 }
Ejemplo n.º 20
0
 public void Start () {
     anim = animation;
     animState = anim[anim.clip.name];
     // reset effects
     percent = 0;
     Sample();
 }
Ejemplo n.º 21
0
 // Use this for initialization
 void Start()
 {
     _transform = transform;
     _lastPosition = _transform.position;
     _walk = animation["walk"];
     _walk.layer = 2;
 }
Ejemplo n.º 22
0
 // Use this for initialization
 void Start()
 {
     walk = animation["walking"];
     foreach (AnimationState state in animation)
     {
         state.speed = 4f;
     }
 }
    void Start()
    {
        lifeValue = life.getBloodValue();
        life.addBloodValueChangeCallback(lifeChangedCall);

        fire1AnimationState = myAnimation["fire1"];
        fire2AnimationState = myAnimation["fire2"];
    }
Ejemplo n.º 24
0
 void Start()
 {
     float frames = _animation.frameRate * _animation.length;//��ȡ֡��
     _startN = _start/frames;//0-1 �淶��
     _endN = _end/frames;//0-1 �淶��
     _animationState = animation[_animation.name];
     _trail.Emit = false;
 }
    void Start()
    {
        state = AnimationState.IDLE;

        status = Status.NOT_FOUND;

        //		RunTowards (new Vector3(transform.position.x +10f, transform.position.y, transform.position.z));
    }
Ejemplo n.º 26
0
 void Start()
 {
     float frames = _animation.frameRate * _animation.length;
     _startN = _start / frames;
     _endN = _end / frames;
     _animationState = GetComponent<Animation>()[_animation.name];
     _trail.Emit = false;
 }
Ejemplo n.º 27
0
		public Animation (IAnimationDrawer drawer, uint duration, Easing easing, Blocking blocking)
		{
			this.Drawer = drawer;
			this.Duration = duration;
			this.Easing = easing;
			this.Blocking = blocking;
			this.AnimationState = AnimationState.Coming;
		}
Ejemplo n.º 28
0
    private void LoadAnimations()
    {
        walkAnimationList = Resources.LoadAll<Sprite>("DwarfWalk").ToList();
        otherAnimationList = Resources.LoadAll<Sprite>("DwarfOther").ToList();

        spriteDirection = SpriteDirection.Down;
        animationState = AnimationState.IdleDown;
    }
Ejemplo n.º 29
0
 // set current animation and restart if it's a different animation
 public void setAnimationState(AnimationState animation)
 {
     if (currentAnimation != animation)
     {
         currentAnimation = animation;
         animationStateTime = 0;
     }
 }
Ejemplo n.º 30
0
 public void Attacking(Actor self, Target target)
 {
     State = AnimationState.Attacking;
     if (anim.HasSequence("shoot"))
         anim.PlayThen("shoot", () => State = AnimationState.Idle);
     else if (anim.HasSequence("heal"))
         anim.PlayThen("heal", () => State = AnimationState.Idle);
 }
Ejemplo n.º 31
0
 public AnimationState(AnimationStateSet parent, AnimationState rhs) : this(OgrePINVOKE.new_AnimationState__SWIG_3(AnimationStateSet.getCPtr(parent), AnimationState.getCPtr(rhs)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 32
0
 /// <summary>
 /// This method loads the animation from the animation name
 /// </summary>
 private void LoadAnimation()
 {
     animationState         = robot.GameEntity.GetAnimationState(animationName);
     animationState.Loop    = true;
     animationState.Enabled = true;
 }
Ejemplo n.º 33
0
    void Update()
    {
        // Animation combo system

        if (ComboAttackLists.Length <= 0)      // if have no combo list
        {
            return;
        }

        comboList = ComboAttackLists[WeaponType].Split(","[0]);        // Get list of animation index from combolists split by WeaponType

        if (comboList.Length > attackStep)
        {
            int poseIndex = int.Parse(comboList[attackStep]);            // Read index of current animation from combo array
            if (poseIndex < PoseAttackNames.Length)
            {
                // checking index of PoseAttackNames list

                AnimationState attackState = this.gameObject.GetComponent <Animation>()[PoseAttackNames[poseIndex]];                // get animation PoseAttackNames[poseIndex]
                attackState.layer     = 2;
                attackState.blendMode = AnimationBlendMode.Blend;
                attackState.speed     = SpeedAttack;

                if (attackState.time >= attackState.length * 0.1f)
                {
                    // set attacking to True when time of attack animation is running to 10% of animation
                    attacking = true;
                }
                if (attackState.time >= PoseAttackTime[poseIndex])
                {
                    // if the time of attack animation is running to marking point (PoseAttackTime[poseIndex])
                    // calling CharacterAttack.cs to push a damage out
                    if (!diddamaged)
                    {
                        // push a damage out
                        this.gameObject.GetComponent <CharacterAttack>().DoDamage();
                    }
                }

                if (attackState.time >= attackState.length * 0.8f)
                {
                    // if the time of attack animation is running to 80% of animation. It's should be Finish this pose.

                    attackState.normalizedTime = attackState.length;
                    diddamaged  = true;
                    attacking   = false;
                    attackStep += 1;

                    if (attackStack > 1)
                    {
                        // checking if a calling attacking is stacked
                        fightAnimation();
                    }
                    else
                    {
                        if (attackStep >= comboList.Length)
                        {
                            // finish combo and reset to idle pose
                            resetCombo();
                            this.gameObject.GetComponent <Animation>().Play(PoseIdle);
                        }
                    }
                    // reset character damage system
                    this.gameObject.GetComponent <CharacterAttack>().StartDamage();
                }
            }
        }

        if (hited)        // Freeze when got hit
        {
            if (frozetime > 0)
            {
                frozetime--;
            }
            else
            {
                hited = false;
                this.gameObject.GetComponent <Animation>().Play(PoseIdle);
            }
        }

        if (Time.time > attackStackTimeTemp + 2)
        {
            resetCombo();
        }
    }
    void Update()
    {
        //If we're not idle, calculate the progress through the current motion.
        if (currentState != AnimationState.Idle)
        {
            movementProgress = (Time.time - movementStartTime) / movementTime;

            //Cap at 1 if needed.
            if (movementProgress > 1f)
            {
                movementProgress = 1f;
            }
        }

        //Perform location calculations based on the current state.
        switch (currentState)
        {
        case AnimationState.Idle:
            //Do nothing if idle.
            break;

        case AnimationState.SingleMovement1:
            //We're moving towards the character.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * objectTarget1.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * objectTarget1.transform.position.y);

            //Update hand position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //Move to the next stage, SingleMovement2.
                currentState          = AnimationState.SingleMovement2;
                movementStartPosition = deathHandObject.transform.position;
                movementStartTime     = Time.time;

                //Toggle hand to closed.
                handAnimator.SetTrigger("ToggleHandState");
            }
            break;

        case AnimationState.SingleMovement2:
            //We're moving towards the destination.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * destination1.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * destination1.transform.position.y);

            //Update hand and character position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);
            objectTarget1.transform.position   = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //In the case of eliminating the last remaining character, we'll already be at the starting location. In that case, we can just enter idle.
                if (deathHandObject.transform.position == startingLocation.transform.position)
                {
                    //We are at the start. Enter the idle state.
                    currentState = AnimationState.Idle;
                }
                else
                {
                    //We aren't at the start, so move to the next stage, Returning.
                    currentState          = AnimationState.Returning;
                    movementStartPosition = deathHandObject.transform.position;
                    movementStartTime     = Time.time;
                }

                //Toggle hand to open.
                handAnimator.SetTrigger("ToggleHandState");
            }
            break;

        case AnimationState.DuoMovement1:
            //We're moving towards the first character.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * objectTarget1.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * objectTarget1.transform.position.y);

            //Update hand position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //Move to the next stage, DuoMovement2.
                currentState          = AnimationState.DuoMovement2;
                movementStartPosition = deathHandObject.transform.position;
                movementStartTime     = Time.time;

                //Toggle hand to closed.
                handAnimator.SetTrigger("ToggleHandState");
            }
            break;

        case AnimationState.DuoMovement2:
            //We're moving towards the first destination.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * destination1.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * destination1.transform.position.y);

            //Update hand and character position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);
            objectTarget1.transform.position   = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //Move to the next stage, DuoMovement3.
                currentState          = AnimationState.DuoMovement3;
                movementStartPosition = deathHandObject.transform.position;
                movementStartTime     = Time.time;

                //Toggle hand to open.
                handAnimator.SetTrigger("ToggleHandState");
            }
            break;

        case AnimationState.DuoMovement3:
            //We're moving towards the second character.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * objectTarget2.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * objectTarget2.transform.position.y);

            //Update hand position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //Move to the next stage, DuoMovement4.
                currentState          = AnimationState.DuoMovement4;
                movementStartPosition = deathHandObject.transform.position;
                movementStartTime     = Time.time;

                //Toggle hand to closed.
                handAnimator.SetTrigger("ToggleHandState");
            }
            break;

        case AnimationState.DuoMovement4:
            //We're moving towards the second destination.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * destination2.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * destination2.transform.position.y);

            //Update hand and character position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);
            objectTarget2.transform.position   = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //Move to the next stage, Returning.
                currentState          = AnimationState.Returning;
                movementStartPosition = deathHandObject.transform.position;
                movementStartTime     = Time.time;

                //Toggle hand to open.
                handAnimator.SetTrigger("ToggleHandState");
            }
            break;

        case AnimationState.Returning:
            //We're returning to the start position.
            newXPosition = ((1 - movementProgress) * movementStartPosition.x) + (movementProgress * startingLocation.transform.position.x);
            newYPosition = ((1 - movementProgress) * movementStartPosition.y) + (movementProgress * startingLocation.transform.position.y);

            //Update hand position.
            deathHandObject.transform.position = new Vector3(newXPosition, newYPosition, startingLocation.transform.position.z);

            //Have we finished the movement?
            if (movementProgress == 1f)
            {
                //Return to the idle state.
                currentState = AnimationState.Idle;
            }
            break;

        default:
            Debug.Log("Animation controller in an unrecognized state.");
            break;
        }
    }
Ejemplo n.º 35
0
 protected override void OnDestroy()
 {
     m_animation             = null;
     m_currentAnimationState = null;
     base.OnDestroy();
 }
Ejemplo n.º 36
0
 public void init(AnimationState ms)
 {
     play(ms);
 }
Ejemplo n.º 37
0
 public bool isSame(AnimationState mX, AnimationState mY)
 {
     return(motionX == mX && motionY == mY);
 }
Ejemplo n.º 38
0
 public bool isSame(AnimationState m)
 {
     return(motionY == null && motionX == m);
 }
        private void ExportMeshAnimation()
        {
            AnimationClip[] animationClips     = exportParams.AnimationClips;
            string[]        animationClipNames = exportParams.AnimationNames;
            GameObject      instanceObj        = Instantiate(fbx) as GameObject;

            UnityEngine.Animation animation          = instanceObj.GetComponentInChildren <UnityEngine.Animation>();
            SkinnedMeshRenderer[] skinnedMeshRenders = instanceObj.GetComponentsInChildren <SkinnedMeshRenderer>();
            int subMeshLength = skinnedMeshRenders.Length;

            Mesh[] subMeshArr = new Mesh[subMeshLength];
            for (int i = 0; i < subMeshLength; i++)
            {
                subMeshArr[i] = skinnedMeshRenders[i].sharedMesh;
            }
            float interval = 1.0f / exportParams.FrameRate;

            if (File.Exists(exportParams.OutputFilePath))
            {
                File.Delete(exportParams.OutputFilePath);
            }
            ExportMeshAnimationData meshAnimationData = ScriptableObject.CreateInstance <ExportMeshAnimationData>();

            meshAnimationData.GenerateNormal = exportParams.GenerateNormal;
            meshAnimationData.SubMeshLength  = subMeshLength;
            meshAnimationData.Fps            = exportParams.FrameRate;
            meshAnimationData.SubMeshData    = new ExportMeshAnimationData.AnimationSubMeshData[subMeshLength];
            for (int i = 0; i < subMeshLength; i++)
            {
                meshAnimationData.SubMeshData[i].ClipDatas = new ExportMeshAnimationData.AnimationClipData[animationClips.Length];
                meshAnimationData.SubMeshData[i].FrameRate = exportParams.FrameRate;
                for (int j = 0; j < animationClips.Length; j++)
                {
                    AnimationClip clip = animationClips[j];
                    if (clip == null)
                    {
                        return;
                    }
                    animation.AddClip(clip, animationClipNames[j]);
                    animation.clip = clip;
                    AnimationState state = animation[animationClipNames[j]];
                    state.enabled = true;
                    state.weight  = 1;
                    List <float> frameTimes = GetFrameTimes(clip.length, interval);
                    meshAnimationData.SubMeshData[i].ClipDatas[j].FrameDatas = new ExportMeshAnimationData.AnimationFrameData[frameTimes.Count];
                    meshAnimationData.SubMeshData[i].ClipDatas[j].ClipName   = animationClipNames[j];
                    for (int k = 0; k < frameTimes.Count; k++)
                    {
                        state.time = frameTimes[k];
                        animation.Play();
                        animation.Sample();
                        Matrix4x4 matrix4X4 = skinnedMeshRenders[i].transform.localToWorldMatrix;
                        Mesh      backMesh  = BakeFrameAfterMatrixTransform(skinnedMeshRenders[i], matrix4X4);
                        meshAnimationData.SubMeshData[i].ClipDatas[j].FrameDatas[k].Vertexs = backMesh.vertices;
                        backMesh.Clear();
                        DestroyImmediate(backMesh);
                        animation.Stop();
                    }
                }
                meshAnimationData.SubMeshData[i].UVs       = subMeshArr[i].uv;
                meshAnimationData.SubMeshData[i].Triangles = subMeshArr[i].triangles;
            }
            AssetDatabase.CreateAsset(meshAnimationData, GetAssetPath(exportParams.OutputFilePath) + fbx.name + ".asset");
            AssetDatabase.Refresh();
        }
Ejemplo n.º 40
0
 public virtual void playMotion(AnimationState ms)
 {
 }
Ejemplo n.º 41
0
 public void Enter()
 {
     this.CurrentState = AnimationState.EnterStart;
 }
    internal void MoveSingleCharacterToLocation(AnimationObject objectTarget, AnimationLocation targetLocation)
    {
        //Set our values used for actual movement.
        //Set reference start position.
        movementStartPosition = startingLocation.transform.position;

        //Set the target.
        switch (objectTarget)
        {
        case AnimationObject.Player:
            objectTarget1 = playerObject;
            break;

        case AnimationObject.AI1:
            objectTarget1 = AI1Object;
            break;

        case AnimationObject.AI2:
            objectTarget1 = AI2Object;
            break;

        case AnimationObject.AI3:
            objectTarget1 = AI3Object;
            break;

        default:
            Debug.Log("Animation controller attempting to move a non-existent object.");
            break;
        }

        //Set the destination.
        switch (targetLocation)
        {
        case AnimationLocation.Pump:
            destination1 = pumpLocation;
            break;

        case AnimationLocation.PlayerLocation:
            destination1 = playerLocation;
            break;

        case AnimationLocation.AI1Location:
            destination1 = AI1Location;
            break;

        case AnimationLocation.AI2Location:
            destination1 = AI2Location;
            break;

        case AnimationLocation.AI3Location:
            destination1 = AI3Location;
            break;

        case AnimationLocation.StartingLocation:
            destination1 = startingLocation;
            break;

        default:
            Debug.Log("Animation controller attempting to move to a non-existent location.");
            break;
        }

        //Set the controller to do a single movement.
        movementStartTime = Time.time;
        currentState      = AnimationState.SingleMovement1;
    }
    internal void MoveDoubleCharacterToLocations(AnimationObject firstTarget, AnimationLocation firstDestination, AnimationObject secondTarget, AnimationLocation secondDestination)
    {
        //Set our values used for actual movement.
        //Set reference start position.
        movementStartPosition = startingLocation.transform.position;

        //Set the first target.
        switch (firstTarget)
        {
        case AnimationObject.Player:
            objectTarget1 = playerObject;
            break;

        case AnimationObject.AI1:
            objectTarget1 = AI1Object;
            break;

        case AnimationObject.AI2:
            objectTarget1 = AI2Object;
            break;

        case AnimationObject.AI3:
            objectTarget1 = AI3Object;
            break;

        default:
            Debug.Log("Animation controller attempting to move a non-existent object.");
            break;
        }

        //Set the first destination.
        switch (firstDestination)
        {
        case AnimationLocation.Pump:
            destination1 = pumpLocation;
            break;

        case AnimationLocation.PlayerLocation:
            destination1 = playerLocation;
            break;

        case AnimationLocation.AI1Location:
            destination1 = AI1Location;
            break;

        case AnimationLocation.AI2Location:
            destination1 = AI2Location;
            break;

        case AnimationLocation.AI3Location:
            destination1 = AI3Location;
            break;

        case AnimationLocation.StartingLocation:
            destination1 = startingLocation;
            break;

        default:
            Debug.Log("Animation controller attempting to move to a non-existent location.");
            break;
        }

        //Set the second target.
        switch (secondTarget)
        {
        case AnimationObject.Player:
            objectTarget2 = playerObject;
            break;

        case AnimationObject.AI1:
            objectTarget2 = AI1Object;
            break;

        case AnimationObject.AI2:
            objectTarget2 = AI2Object;
            break;

        case AnimationObject.AI3:
            objectTarget2 = AI3Object;
            break;

        default:
            Debug.Log("Animation controller attempting to move a non-existent object.");
            break;
        }

        //Set the second destination.
        switch (secondDestination)
        {
        case AnimationLocation.Pump:
            destination2 = pumpLocation;
            break;

        case AnimationLocation.PlayerLocation:
            destination2 = playerLocation;
            break;

        case AnimationLocation.AI1Location:
            destination2 = AI1Location;
            break;

        case AnimationLocation.AI2Location:
            destination2 = AI2Location;
            break;

        case AnimationLocation.AI3Location:
            destination2 = AI3Location;
            break;

        case AnimationLocation.StartingLocation:
            destination2 = startingLocation;
            break;

        default:
            Debug.Log("Animation controller attempting to move to a non-existent location.");
            break;
        }

        //Set the controller to do a duo movement.
        movementStartTime = Time.time;
        currentState      = AnimationState.DuoMovement1;
    }
Ejemplo n.º 44
0
        /// <summary>
        /// Convenience method for duplicating a skeleton's current active skin so changes to it will not affect other skeleton instances. .</summary>
        public static Skin UnshareSkin(this Skeleton skeleton, bool includeDefaultSkin, bool unshareAttachments, AnimationState state = null)
        {
            // 1. Copy the current skin and set the skeleton's skin to the new one.
            var newSkin = skeleton.GetClonedSkin("cloned skin", includeDefaultSkin, unshareAttachments, true);

            skeleton.SetSkin(newSkin);

            // 2. Apply correct attachments: skeleton.SetToSetupPose + animationState.Apply
            if (state != null)
            {
                skeleton.SetToSetupPose();
                state.Apply(skeleton);
            }

            // 3. Return unshared skin.
            return(newSkin);
        }
Ejemplo n.º 45
0
    // Update is called once per frame
    void Update()
    {
        if (Player.name == "Player 1")
        {
            RunSpeed   = Perks.GetComponent <PerkScript>().Player1RunSpeed;
            JumpSpeed  = Perks.GetComponent <PerkScript>().Player1JumpSpeed;
            ReloadTime = Perks.GetComponent <PerkScript>().Player1ReloadSpeed;
        }
        else
        {
            RunSpeed   = Perks.GetComponent <PerkScript>().Player2RunSpeed;
            JumpSpeed  = Perks.GetComponent <PerkScript>().Player2JumpSpeed;
            ReloadTime = Perks.GetComponent <PerkScript>().Player2ReloadSpeed;
        }

        switch (animationState)
        {
        case AnimationState.NONE:
            animator.SetBool("isIdle", false);
            animator.SetBool("isRunning", false);
            animator.SetBool("isJumping", false);
            animator.SetBool("isCrouch", false);
            animator.SetBool("ShootLow", false);
            break;

        case AnimationState.IDLE:
            animator.SetBool("isIdle", true);
            animator.SetBool("isRunning", false);
            animator.SetBool("isJumping", false);
            animator.SetBool("isCrouch", false);
            animator.SetBool("ShootLow", false);

            break;

        case AnimationState.RUNNING:
            animator.SetBool("isIdle", false);
            animator.SetBool("isRunning", true);
            animator.SetBool("isJumping", false);
            animator.SetBool("isCrouch", false);
            animator.SetBool("ShootLow", false);

            break;

        case AnimationState.JUMP:
            animator.SetBool("isIdle", false);
            animator.SetBool("isRunning", false);
            animator.SetBool("isJumping", true);
            animator.SetBool("isCrouch", false);
            animator.SetBool("ShootLow", false);

            break;

        case AnimationState.CROUCH:
            animator.SetBool("isIdle", false);
            animator.SetBool("isRunning", false);
            animator.SetBool("isJumping", false);
            animator.SetBool("isCrouch", true);
            animator.SetBool("ShootLow", false);
            break;

        case AnimationState.SHOOTLOW:
            animator.SetBool("isIdle", false);
            animator.SetBool("isRunning", false);
            animator.SetBool("isJumping", false);
            animator.SetBool("isCrouch", false);
            animator.SetBool("ShootLow", true);
            break;



        default:
            break;
        }

        if (Player.gameObject.name == "Player 1")
        {
            isPaused = GetComponent <PauseMenuScript>().isPaused;
        }
        else
        {
            isPaused = Enemy.GetComponent <PauseMenuScript>().isPaused;
        }

        EnemyCover = Enemy.GetComponent <Players>().InCover; // checks if the enemy is in cover
        MuzzleFlashFunct();                                  //Function that handles muzzle flashes
        //***************This makes the player pull out their gun when comming out of cover***************************
        if (InCover)

        {
            //  Gun.SetActive(false);
        }
        else
        {
            // Gun.SetActive(true);
        }
        if (InCover && !ChooseJump && !ChooseRun)
        {
            animationState = AnimationState.CROUCH;
        }

        Aiming();
        //***************************Resets the game for testing purposes************************************************************************
        if (Input.GetKeyDown(Reset))
        {
            Player.transform.position = new Vector2(Spawn.transform.position.x, Spawn.transform.position.y);
            CoverPosition             = 0;


            Enemy.GetComponent <Players>().InCover = true;
            ChooseRun  = false;
            ChooseJump = false;
            jumping    = false;
            InCover    = false;
        }



        //****************************This handles when a player hits another player ******************************

        if (((DeadTime1 - DeadTime2) > BulletHitTime) && ShotLow && !EnemyCover && !Enemy.GetComponent <Players>().ChooseJump) //Determines the delay between bullet firing and hitting target
        {
            Enemy.transform.position = Enemy.GetComponent <Players>().Spawn.transform.position;                                //Respawns the hit player
            //resets variables
            Enemy.GetComponent <Players>().CoverPosition = 0;
            Enemy.GetComponent <Players>().CanShoot      = true;
            Enemy.GetComponent <Players>().InCover       = false;
            Enemy.GetComponent <Players>().ChooseRun     = false;
            Enemy.GetComponent <Players>().jumping       = false;
            Enemy.GetComponent <Players>().ChooseJump    = false;
            ShotLow = false;
            AudioManager.instance.PlaySFX(2);
        }
        else if (((DeadTime1 - DeadTime2) > BulletMissTime)) //This means the bullet has passed and wont hit the player
        {
            ShotLow = false;
        }
        //This just does the same thing as the statement above but for when the player jumps
        if (((DeadTime1 - DeadTime2) > BulletHitTime) & ShotHigh && !EnemyCover && Enemy.GetComponent <Players>().ChooseJump)
        {
            Enemy.transform.position = Enemy.GetComponent <Players>().Spawn.transform.position; //respawns enemy
            //reset variables
            Enemy.GetComponent <Players>().CoverPosition = 0;
            Enemy.GetComponent <Players>().jumping       = false;
            Enemy.GetComponent <Players>().CanShoot      = true;
            ShotHigh = false;
            Enemy.GetComponent <Players>().InCover    = true;
            Enemy.GetComponent <Players>().ChooseRun  = false;
            Enemy.GetComponent <Players>().ChooseJump = false;
            AudioManager.instance.PlaySFX(2);
        }
        else if (((DeadTime1 - DeadTime2) > 0.6f))
        {
            ShotHigh = false;
        }

        PlayerChoosesRun();

        PlayerChoosesJump();

        //*************************This determines whether the character is able to move to the next cover position for running********************
        if (Input.GetKeyDown(Run) && InCover == false && !reloading && !ChooseJump && !isPaused)
        {
            if (CoverPosition == 0)
            {
                CanShoot  = false;
                ChooseRun = true;
                // Player.transform.position = new Vector2(Player.transform.position.x, Player.transform.position.y - .7f);
            }
            else if (CoverPosition == 1)
            {
                ChooseRun = true;
                CanShoot  = false;
                // Player.transform.position = new Vector2(Player.transform.position.x, Player.transform.position.y - .7f);
            }
            else if (CoverPosition <= 2)
            {
                ChooseRun = true;
                CanShoot  = false;
                //  Player.transform.position = new Vector2(Player.transform.position.x, Player.transform.position.y - .7f);
            }
            else if (CoverPosition <= 3)
            {
                CanShoot  = false;
                ChooseRun = true;
                // Player.transform.position = new Vector2(Player.transform.position.x, Player.transform.position.y - .7f);
            }
        }


        if (Input.GetKeyDown(Jump) && InCover == false && !reloading && !ChooseRun && !isPaused)
        {
            if (CoverPosition == 0)
            {
                CanShoot   = false;
                ChooseJump = true;
            }
            else if (CoverPosition == 1)
            {
                ChooseJump = true;
                CanShoot   = false;
            }
            else if (CoverPosition <= 2)
            {
                ChooseJump = true;
                CanShoot   = false;
            }
            else if (CoverPosition <= 3)
            {
                CanShoot   = false;
                ChooseJump = true;
            }
        }

        //**********************This moves the player in and out of cover**************************************
        if (Input.GetKeyDown(Peak) && InCover == true && CanShoot && !isPaused)
        {
            //  Player.transform.position = new Vector2(Player.transform.position.x, Player.transform.position.y + .7f);
            InCover = false;
            // Debug.Log("test1");
            animationState = AnimationState.IDLE;
        }
        if (Input.GetKeyDown(Duck) && InCover == false && CanShoot && !isPaused)
        {
            // Player.transform.position = new Vector2(Player.transform.position.x, Player.transform.position.y - .7f);
            InCover = true;
            //animationState = AnimationState.Crouch;
            // Debug.Log("test");
        }



        rlt1 = Time.fixedTime;
        if (Input.GetKeyDown(Reload) && InCover && !reloading && !isPaused && !BulletLoaded)
        {
            Debug.Log("reloading");
            reloading = true;
            rlt2      = Time.fixedTime;
        }


        else if ((rlt1 - rlt2) >= ReloadTime && reloading && !BulletLoaded)
        {
            Debug.Log("reloading complete");
            reloading    = false;
            BulletLoaded = true;
            AudioManager.instance.PlaySFX(1);
        }
    }
Ejemplo n.º 46
0
        public void Start(AnimationState state, int trackIndex)
        {
#if !WINDOWS_STOREAPP
            Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": start");
#endif
        }
Ejemplo n.º 47
0
 private AnimationState Play(AnimationData anim)
 {
     currState = target[anim.name];
     target.CrossFade(anim.name, 0.1f, PlayMode.StopAll);
     return(currState);
 }
Ejemplo n.º 48
0
        public void Complete(AnimationState state, int trackIndex, int loopCount)
        {
#if !WINDOWS_STOREAPP
            Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
#endif
        }
Ejemplo n.º 49
0
 public void OnSit()
 {
     animState = AnimationState.Sitting;
 }
Ejemplo n.º 50
0
 public void OnStand()
 {
     animState = AnimationState.Standing;
 }
Ejemplo n.º 51
0
        public void Event(AnimationState state, int trackIndex, Event e)
        {
#if !WINDOWS_STOREAPP
            Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
#endif
        }
Ejemplo n.º 52
0
        private void RemoveCore(AnimatedWidget widget, uint duration, Easing easing, Blocking blocking, bool use_easing, bool use_blocking)
        {
            if (duration > 0)
            {
                widget.Duration = duration;
            }

            if (use_easing)
            {
                widget.Easing = easing;
            }

            if (use_blocking)
            {
                widget.Blocking = blocking;
            }

            if (widget.AnimationState == AnimationState.Coming)
            {
                widget.AnimationState = AnimationState.IntendingToGo;
            }
            else
            {
                if (widget.Easing == Easing.QuadraticIn)
                {
                    widget.Easing = Easing.QuadraticOut;
                }
                else if (widget.Easing == Easing.QuadraticOut)
                {
                    widget.Easing = Easing.QuadraticIn;
                }
                else if (widget.Easing == Easing.ExponentialIn)
                {
                    widget.Easing = Easing.ExponentialOut;
                }
                else if (widget.Easing == Easing.ExponentialOut)
                {
                    widget.Easing = Easing.ExponentialIn;
                }
                widget.AnimationState = AnimationState.Going;
                stage.Add(widget, widget.Duration);
            }

            duration = widget.Duration;
            easing   = widget.Easing;

            active_count--;
            if (active_count == 0)
            {
                if (border_state == AnimationState.Coming)
                {
                    border_bias = Percent;
                }
                else
                {
                    border_easing = easing;
                    border_bias   = 1.0;
                }
                border_state = AnimationState.Going;
                border_stage.Reset((uint)(duration * border_bias));
            }
        }
Ejemplo n.º 53
0
 private void OnAnimationStateChanged(AnimationState state)
 {
     playShortcutButton.Checked = state == AnimationState.Playing || state == AnimationState.AnimationRecording;
 }
Ejemplo n.º 54
0
 public void SetState(AnimationState animationState)
 {
     _animationState = animationState;
 }
Ejemplo n.º 55
0
 public void fly()
 {
     animationState         = ammunitionModel.GetAnimationState("flying");
     animationState.Loop    = true;
     animationState.Enabled = true;
 }
Ejemplo n.º 56
0
        public static Skin UnshareSkin(this Skeleton skeleton, bool includeDefaultSkin, bool unshareAttachments, AnimationState state = null)
        {
            Skin newSkin = skeleton.GetClonedSkin("cloned skin", includeDefaultSkin, unshareAttachments, true);

            skeleton.SetSkin(newSkin);
            if (state != null)
            {
                skeleton.SetToSetupPose();
                state.Apply(skeleton);
            }
            return(newSkin);
        }
Ejemplo n.º 57
0
        public void update()
        {
            if (remainingTime <= 0.0f)
            {
                return;
            }


            if (remainingTime > 0.0f)
            {
                remainingTime -= GM.t.delta;


                if (remainingTime <= 0.0f)
                {
                    if (msCurrent)
                    {
                        msCurrent.weight = 1.0f;
                    }

                    if (msPrev)
                    {
                        msPrev.enabled = false;

                        msPrev = null;
                    }

                    if (msPrePrev)
                    {
                        msPrePrev.enabled = false;

                        msPrePrev = null;
                    }
                }
                else
                {
                    var t = remainingTime;

                    var _dt = t * t * totalTimePowerR;

                    var preprevweight = 0.0f;


                    if (msCurrent)
                    {
                        msCurrent.weight = 1.0f - _dt;
                    }

                    if (msPrePrev)
                    {
                        msPrePrev.weight -= GM.t.delta * totalTimePowerR;

                        preprevweight = msPrePrev.weight;

                        if (preprevweight <= 0.0f)
                        {
                            msPrePrev.enabled = false;

                            msPrePrev = null;
                        }
                    }

                    if (msPrev)
                    {
                        msPrev.weight = _dt - preprevweight;
                    }
                }
            }
        }
Ejemplo n.º 58
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AnimationState obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 59
0
 public MotionUnit2D(AnimationState m, float time, float targ, bool isVec) : this(m, null, time, targ, isVec)
 {
 }
Ejemplo n.º 60
0
        public void OnPulse()
        {
            if (!LastLoop.IsRunning)
            {
                LastLoop.Start();
            }
            if (!LastFullEvaluation.IsRunning)
            {
                LastFullEvaluation.Start();
            }
            if (!ZetaDia.IsInGame || !ZetaDia.Me.IsValid || ZetaDia.Me.IsDead || ZetaDia.IsLoadingWorld)
            {
                return;
            }
            AnimationState aState = ZetaDia.Me.CommonData.AnimationState;

            if (aState == AnimationState.Attacking ||
                aState == AnimationState.Casting ||
                aState == AnimationState.Channeling ||
                aState == AnimationState.Dead ||
                aState == AnimationState.TakingDamage)
            {
                return;
            }

            // FUGLY HACK
            // DB .302+ runs through the stashing routine like Flash Gordon... Can't use a soft hook like the Potion method...
            // TODO: Look into overloading the TownRun routine and appending stash checks on TownRuns...
            if (Zeta.Internals.UIElements.StashWindow.IsVisible)
            {             // Stash Checks
                Diagnostic("UIElement Detected: StashWindow, Initiating Stash Checks...");
                if (bCheckStash)
                {
                    // Spam Prevention (Can not run more than once per 3 minutes)
                    double _tempLastStashCheck = DateTime.Now.Subtract(_lastStashCheck).TotalSeconds;
                    Diagnostic("Last potion was purchased " + _tempLastStashCheck + " seconds ago");
                    if (_tempLastStashCheck < 180)
                    {
                        Diagnostic("CheckPotions can not run again for another " + (180 - _tempLastStashCheck) + " seconds");
                    }
                    else
                    {
                        BotMain.PauseWhile(CheckStash, 0, new TimeSpan?(TimeSpan.FromSeconds(30.0)));
                    }
                }
            }

            // Spam Prevention (Can not run more than once per 3 Seconds)
            if (LastLoop.ElapsedMilliseconds > 3000)
            {
                LastLoop.Restart();
                try
                {
                    if (LastFullEvaluation.ElapsedMilliseconds > 300000)
                    {
                        LastFullEvaluation.Restart();
                        bNeedFullItemUpdate = true;
                    }

                    if (currentLevel != ZetaDia.Me.Level)
                    {
                        LastFullEvaluation.Restart();
                        bNeedFullItemUpdate = true;
                        currentLevel        = ZetaDia.Me.Level;
                    }

                    if (Zeta.Internals.UIElements.VendorWindow.IsVisible)
                    {                     // Vendor Checks
                        Diagnostic("UIElement Detected: VendorWindow, Initiating Potion Checks...");
                        if (bBuyPots)
                        {
                            // Spam Prevention (Can not run more than once per 1 minute)
                            double _tempLastBuy = DateTime.Now.Subtract(_lastBuy).TotalSeconds;
                            Diagnostic("Last potion was purchased " + _tempLastBuy + " seconds ago");
                            if (_tempLastBuy < 60)
                            {
                                Diagnostic("CheckPotions can not run again for another " + (60 - _tempLastBuy) + " seconds");
                            }
                            else
                            {
                                BotMain.PauseWhile(CheckPotions, 0, new TimeSpan?(TimeSpan.FromSeconds(30.0)));
                            }
                        }
                    }
                    else if (Zeta.Internals.UIElements.StashWindow.IsVisible)
                    {                     // Stash Checks
                        // Moved outside of the spam prevention loop... So that it will check on every pulse..
                    }
                    else
                    {                     // Backpack Checks
                        CheckBackpack();
                    }
                }
                catch (System.AccessViolationException ex)
                {
                    // Maybe someday the DB core will stop throwing this error.... O_o
                    throw;
                }
                catch (Exception ex)
                {
                    Log("An exception occured: " + ex.ToString());
                    //throw;
                }
            }
        }