Пример #1
0
        void Start()
        {
            anim	= gameObject.GetComponent<Animator>();

            Animations	= anim.runtimeAnimatorController.animationClips;
            Animations	= Animations.Where((animation) => animation.name.Contains("@sd_")).OrderBy((animation) => animation.name).ToArray();
        }
Пример #2
0
    public void GenerateAnimations()
    {
        animationClips = new AnimationClip[sortedFrames.Length / 3];

        int animationCount = 0;
        for (int i=0; i<animationClips.Length; i++) {
            if (animationNames[i] != "") {
                AnimationClip animationClip;
                if (isOneFrame[i]) {
                    animationClip = GenerateAnimation(animationNames[i], frameRate, i * 3 + 1, 1); // use 2nd sprite
                } else {
                    animationClip = GenerateAnimation(animationNames[i], frameRate, i * 3, 4);

                    SerializedObject serializedClip = new SerializedObject(animationClip);
                    AnimationClipSettings clipSettings = new AnimationClipSettings(serializedClip.FindProperty("m_AnimationClipSettings"));

                    clipSettings.loopTime = true;

                    serializedClip.ApplyModifiedProperties();
                }

                animationClips[animationCount] = animationClip;
                animationCount++;
            }
        }
    }
	// Use this for initialization
	void Start ()
	{
		animations = new AnimationClip[5];
		animations[0] = null;
		animations[1] = tornado;
		animations[2] = meteor;
		animations[3] = flood;
		animations[4] = ufo;
		current = this;
	}
Пример #4
0
	// Use this for initialization
	void Start () {
		// if any of animation is not present, then we disable the controller
		if (impactBack==null || impactLeft == null || impactRight == null)
			impactFront = null;
			
		if (impactFront != null) {
			// initialize animations
			SetupAnimations(impactFront);
			SetupAnimations(impactBack);
			SetupAnimations(impactLeft);
			SetupAnimations(impactRight);
		}
		
		cc = GetComponent<CharacterController>();
	}
Пример #5
0
    void Awake()
    {
        animation = GetComponent<Animation>();

        if(!animation) Debug.Log("Gardain doesn't have animations.");

        if(!stanceAnimation)
        {
            animation = null;
            Debug.Log("No Stance animation found. Turning off animations.");
        }
        if(!lookUpAnimation)
        {
            animation = null;
            Debug.Log("No LookUp animation found. Turning off animations.");
        }
        if(!pointTheWayAnimation)
        {
            animation = null;
            Debug.Log("No PointTheWay animation found. Turning off animations.");
        }
        if (!sayNoAnimation)
        {
            animation = null;
            Debug.Log("No SayNo animation found. Turning off animations.");
        }
        if (!putHandInHeadAnimation)
        {
            animation = null;
            Debug.Log("No PutHandInHead animation found. Turning off animations.");
        }

        medrash = GameObject.FindGameObjectWithTag("Player");
        StartCoroutine(VerifyDistanceToMainCharacter());

        animationArray = new AnimationClip[4];
        animationArray[0] = lookUpAnimation;
        animationArray[1] = pointTheWayAnimation;
        animationArray[2] = sayNoAnimation;
        animationArray[3] = putHandInHeadAnimation;
    }
Пример #6
0
 void OnEnable()
 {
     targetAnimation = (Animation)target;
     animationClips = AnimationUtility.GetAnimationClips(targetAnimation.gameObject);
 }
Пример #7
0
    public void SetAttackAnimation(AnimationClip[] aniAttack)
    {
        animationAttack=aniAttack;

        if(animationBody==null) return;
        else {
            if(aniBody==null){
                aniBody=animationBody.GetComponent<Animation>();
                if(aniBody==null) aniBody=animationBody.AddComponent<Animation>();
            }
        }

        if(aniBody!=null && animationAttack!=null && animationAttack.Length>0){
            foreach(AnimationClip clip in animationAttack){
                aniBody.AddClip(clip, clip.name);
                aniBody.animation[clip.name].layer=5;
                aniBody.animation[clip.name].wrapMode=WrapMode.Once;
            }
        }
    }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        if (CanBePaused)
            gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager>();

        objectAnimator = gameObject.GetComponent<Animator>();

        if (objectAnimator != null)
        {
            RuntimeAnimatorController animController = objectAnimator.runtimeAnimatorController;

            animationArray = animController.animationClips;

            for (int i = 0; i < animationArray.Length; i++)
            {
                animationNamesList.Add(animationArray[i].name);
            }

            currentAnimName = animationNamesList[0];
        }
    }
Пример #9
0
    void SetMecanimData()
    {
        if (gogoAnimator.animator == null)
        {
            return;
        }

        animationClipArray = AnimationUtility.GetAnimationClips(gogoAnimator.gameObject);

        animationStateList.Clear();
        animationStateNameList.Clear();

        AnimatorController ac = gogoAnimator.animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;
        if (ac != null)
        {
            for (int i = 0; i < ac.layers.Length; i++)
            {
                AnimatorControllerLayer layer = ac.layers[i];

                for (int j = 0; j < layer.stateMachine.states.Length; j++)
                {
                    animationStateList.Add(layer.stateMachine.states[j]);
                    animationStateNameList.Add(layer.stateMachine.states[j].state.name);
                }
            }
        }
    }
Пример #10
0
	[RPC] void SetGun(int slot, int gun)
	{
		if(slot==0)
		{
			if(gun==0)
			{
				primaryAmmoLeft+=ammoInMainGun;
				ammoInMainGun=0;
				mainGunClipsize=primaryClipsizes[0];
				mainGunFireSpeed=primaryFireSpeed[0];
				isAutoPrimary=autoPrimary[0];
				reloadSounds[0]=primaryReloadSounds[0];
				fireSounds[0]=primaryShootSounds[0];
				mainGunAnims=revolverAnims;
				if(primaryAmmoLeft>0)
				{
					int ammoUsed = mainGunClipsize - ammoInMainGun;
					ammoInMainGun = mainGunClipsize;
					primaryAmmoLeft-=ammoUsed;
					if(primaryAmmoLeft<0)
					{
						ammoInMainGun+=primaryAmmoLeft;
						primaryAmmoLeft=0;
					}
					RecalcAmmoMeter();
				}
				networkView.RPC("EnableGun", RPCMode.All, 0, false);
				mainGunOut=false;
				mainGun=revolver;
				primaryDamage=primaryDamageL[0];
				mainGunR=mainGun.transform.GetChild(0).gameObject;
				int teamI=0;
				if(team=="Blue")
					teamI=1;
				mainGunR.renderer.material.color=mainGcolors[teamI];
			}
			else if(gun==1)
			{
				primaryAmmoLeft+=ammoInMainGun;
				ammoInMainGun=0;
				mainGunClipsize=primaryClipsizes[1];
				mainGunFireSpeed=primaryFireSpeed[1];
				isAutoPrimary=autoPrimary[1];
				reloadSounds[0]=primaryReloadSounds[1];
				fireSounds[0]=primaryShootSounds[1];
				mainGunAnims=machinegunAnims;
				if(primaryAmmoLeft>0)
				{
					int ammoUsed = mainGunClipsize - ammoInMainGun;
					ammoInMainGun = mainGunClipsize;
					primaryAmmoLeft-=ammoUsed;
					if(primaryAmmoLeft<0)
					{
						ammoInMainGun+=primaryAmmoLeft;
						primaryAmmoLeft=0;
					}
					RecalcAmmoMeter();
				}
				networkView.RPC("EnableGun", RPCMode.All, 0, false);
				mainGunOut=false;
				mainGun=machinegun;
				primaryDamage=primaryDamageL[1];
				mainGunR=mainGun.transform.GetChild(0).gameObject;
				int teamI=0;
				if(team=="Blue")
					teamI=1;
				mainGunR.renderer.material.color=mainGcolors[teamI];
			}
		}
	}
Пример #11
0
        public SkinnedTemplateBakedData(string meshName, int clipCount, SkinnedMeshRenderer skinMeshRenderer, Animation animation)
        {
            this.name = meshName;
            this.BakedClips = new MeshSequence[clipCount];
            this.AnimationClipsToBake = new AnimationClip[clipCount];

            this.BakeSkinnedMesh(animation, skinMeshRenderer);
        }