void Start () { gmc = GameObject.FindGameObjectWithTag("GameController").GetComponent<Spawner>(); print(gmc.sprites[gmc.num]); /*anim = GameObject.FindGameObjectsWithTag("animation"); anim.SetActive(false);*/ skeletonAnimation = GameObject.FindGameObjectWithTag("animation").GetComponent<SkeletonAnimation>(); skeletonAnimation.enabled = true; gmv = GameObject.FindGameObjectWithTag("GameOver"); cnt = GameObject.FindGameObjectWithTag("animation"); //gmv.SetActive(false); gameOv =GameObject.FindGameObjectWithTag("GameOver").GetComponent<SkeletonAnimation>(); if(this.gameObject.GetComponent<TapCounter>().enabled){ skeletonAnimation.state.SetAnimation(0, "tap_amount_in", false); skeletonAnimation.state.AddAnimation(0, "tap_amount_loop", true, 0.3f); } gmv.SetActive(false); cnt.SetActive(true); /*gmv = GameObject.FindGameObjectWithTag("GameOver"); cnt = GameObject.FindGameObjectWithTag("animation"); gmv.SetActive(false);*/ AudioSource[] sources = GetComponents<AudioSource>(); tap = sources[0]; bad = sources[1]; good = sources[2]; spw = GameObject.FindGameObjectWithTag("GameController").GetComponent<Spawner>(); sc = GameObject.FindGameObjectWithTag("Score").GetComponent<ScoreController>(); scoreCounter.text = ""; }
public void Start() { skeletonAnimation = GetComponent<SkeletonAnimation>(); skeletonAnimation.state.SetAnimation(0, "walk", true); skeletonAnimation.state.Event += new EventHandler<EventTriggeredArgs>(Event); }
void Start() { skeletonAnimation = GetComponent<SkeletonAnimation>(); ColiderScript cs = GetComponentInChildren<ColiderScript>(); cs.TriggerEnter += OnTriggerEnter; cs.CollisionEnter += OnCollisionEnter; }
void Start() { Anim = GetComponent<SkeletonAnimation>(); Anim.state.SetAnimation(0, "boywalk", true); transform.DOMove(endPositon, timeMove).OnComplete(turnOffAnim); }
// Use this for initialization void Start() { tweenOrthoSize = GetComponent<TweenOrthoSize>(); tweenPosition = GetComponent<TweenPosition>(); TouchUI = GameObject.Find("TouchUI"); skeletonAnimation = GameObject.Find("title").GetComponent<SkeletonAnimation>(); }
void Start() { m_anim = GetComponent< SkeletonAnimation > (); m_anim.state.Event += HandleEvent; m_anim.state.End += EndEvent; SetAnimation (PLAYER_IDLE_ANIN, true); }
// Use this for initialization void Start () { skeletonAnimation = GameObject.FindGameObjectWithTag("animation").GetComponent<SkeletonAnimation>(); //Invoke("BeginUI", 0); //Invoke("UImenu", 0.4f); skeletonAnimation.state.SetAnimation(0, "menu_in", false); skeletonAnimation.state.AddAnimation(0, "menu_loop", true, 0); }
void Start() { mama_Anim = mama.GetComponent<SkeletonAnimation>(); Mama_ChangeAnimaton(AnimationNames.lv_finish_mama_walk, true); house_door.transform.DOMove(endCua.position, 1).OnComplete(change_isMove); Inst = this; }
// Use this for initialization void Start() { m_transform = this.transform; m_animation = this.GetComponent<SkeletonAnimation>(); m_animation.timeScale = Random.Range(0.8f, 1.2f); m_animation.state.Event += state_Event; m_animation.state.End += state_End; }
void Start () { originalPosition = transform.position; originalScale = transform.localScale; audioSource = GetComponent<AudioSource>(); spine = GetComponent<SkeletonAnimation>(); }
void Start () { // Make sure you get these AnimationState and Skeleton references in Start or Later. Getting and using them in Awake is not guaranteed by default execution order. skeletonAnimation = GetComponent<SkeletonAnimation>(); spineAnimationState = skeletonAnimation.state; skeleton = skeletonAnimation.skeleton; StartCoroutine(DoDemoRoutine()); }
void Start() { transform.parent = null; controller = GetComponent<Controller2D>(); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; spineAnim = GetComponent<SkeletonAnimation>(); randomMeow = Random.Range (1.5f, 3f); }
void Start() { if (speedReference == null) speedReference = transform; skeletonAnimation = GetComponent<SkeletonAnimation>(); bone = SpineBone.GetBone(boneName, skeletonAnimation); skeletonAnimation.UpdateLocal += UpdateLocal; lastPosition = speedReference.position; }
void Awake() { _equipment = GetComponent<EquipmentComponent>(); _movement = GetComponent<MovementComponent>(); _health = GetComponent<HealthComponent>(); _skelAnim = GetComponent<SkeletonAnimation>(); _health.armorValue = _equipment.GetArmor(); }
void Start() { // Get the SkeletonAnimation component for the GameObject this script is attached to. skeletonAnimation = GetComponent<SkeletonAnimation>(); // Call our method any time an animation fires an event. skeletonAnimation.state.Event += Event; // Queue jump to be played on track 0 two seconds after the starting animation. skeletonAnimation.state.AddAnimation(0, "jump", false, 2); // Queue walk to be looped on track 0 after the jump animation. skeletonAnimation.state.AddAnimation(0, "run", true, 0); }
// Use this for initialization void Start() { sktAnimator = GetComponent<SkeletonAnimator>(); if (sktAnimator == null) { Debug.LogError("sktAnimator == null"); } else { sktAnimator.GetSkeleton().flipX = true; sktAnimator.GetSkeleton().SetColor(new Color(1.0f, 0.0f, 0.0f)); } sktAnimation = GetComponent<SkeletonAnimation>(); if (sktAnimation == null) { Debug.LogError("sktAnimation == null"); } else { Debug.Log("animation : " + sktAnimation.state.GetCurrent(0)); } animator = GetComponent<Animator>(); if (animator == null) { Debug.LogError("animator == null"); } else { AnimatorClipInfo[] items = animator.GetCurrentAnimatorClipInfo(0); Debug.Log("items length : " + items.Length); foreach (AnimatorClipInfo item in items) { Debug.Log("" + item.clip.name); } Debug.Log("ok"); // Debug.Log ("animator : " + animator.GetComponent<UnityEngine.Animation>().name); } sktUtility = GetComponent<SkeletonUtility>(); if (sktUtility == null) { Debug.LogError ("sktUtility == null"); } else { Debug.Log ("123123" + sktUtility.skeletonAnimation.Skeleton.Slots); // foreach (Slot item in sktUtility.skeletonAnimation.Skeleton.Slots) // { // Debug.Log ("item : " + item.ToString()); // if (item.ToString().Equals("front_bracer")) // { // item.SetColor(new Color(0.0f, 1.0f, 0.0f)); // } // } } }
void Start(){ controller = GetComponent<Controller2D>(); velocity = new Vector3(); gravity = -2 * jumpHeight / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; print ("gravity: " + gravity + " jump velocity:" + jumpVelocity + " deltaTime:" + Time.deltaTime); //Spine Stuff skeletonAnimation = GetComponent<SkeletonAnimation>(); }
// Use this for initialization void Start() { m_tansform = this.transform; m_animation = this.GetComponent<SkeletonAnimation>(); playerObj = GameObject.Find("Hero"); m_playerScript = playerObj.GetComponent<PlayerActions>(); //m_animation.state.Event += state_Event; m_animation.state.End += state_End; m_audioManager = GameObject.Find("Audios").GetComponent<AudioManager>(); }
// Use this for initialization void Start() { m_camera = this.GetComponent<Camera>(); origSize = m_camera.orthographicSize; m_camera.orthographicSize = origSize * largeRatio; //UIObj = GameObject.Find("UI"); //UIChangeScript = UIObj.GetComponent<UIchange>(); bgAnimationObj = GameObject.Find("bgAnimation"); bgAnimationScript = bgAnimationObj.GetComponent<SkeletonAnimation>(); bgAnimationScript.state.End += state_End; }
void Start() { clock = GetComponent<SkeletonAnimation>(); clockState = clock.state; clockState.TimeScale = 1.0f; clockState.SetAnimation(0, "loop", true); armLong = clock.skeleton.FindBone ("arm-long"); armShort = clock.skeleton.FindBone ("arm-short"); needle = clock.skeleton.FindBone ("needle"); Debug.Log (armLong); Debug.Log (armShort); Debug.Log (needle); }
public void Start () { // Get the SkeletonAnimation component for the GameObject this script is attached to. skeletonAnimation = GetComponent<SkeletonAnimation>(); // Call our method any time an animation fires an event. skeletonAnimation.state.Event += Event; // A lambda can be used for the callback instead of a method. skeletonAnimation.state.End += (state, trackIndex) => { Debug.Log("start: " + state.GetCurrent(trackIndex)); }; // Queue jump to be played on track 0 two seconds after the starting animation. skeletonAnimation.state.AddAnimation(0, "jump", false, 2); // Queue walk to be looped on track 0 after the jump animation. skeletonAnimation.state.AddAnimation(0, "run", true, 0); }
// Use this for initialization void Start() { m_camera = this.GetComponent<Camera>(); origSize = m_camera.orthographicSize; m_camera.orthographicSize = origSize * largeRatio; //UIObj = GameObject.Find("UI"); //UIChangeScript = UIObj.GetComponent<UIchange>(); bgAnimationObj = GameObject.Find("bgAnimation"); bgAnimationScript = bgAnimationObj.GetComponent<SkeletonAnimation>(); bgAnimationScript.state.End += state_End; scoreManagerScript = GameObject.Find("Kill").GetComponent<ScoreManager>(); m_TouchController = GameObject.Find("TouchController").GetComponent<MyTouchController>(); }
public void SetDevice( PlayerDevice device ) { this.device = device; unitstats = gameObject.GetComponent<UnitStats>(); movement = gameObject.GetComponent<Movement>(); skeletonAnimation = gameObject.GetComponentInChildren<SkeletonAnimation>(); skeletonAnimation.state.Event += Event; skeletonAnimation.UpdateBones += UpdateBones; skeletonAnimation.state.End += End; head = gameObject.GetComponentInChildren<SkeletonAnimation>().skeleton.FindBone("head"); hip = gameObject.GetComponentInChildren<SkeletonAnimation>().skeleton.FindBone("body"); weaponmanager = gameObject.GetComponentInChildren<WeaponManager>(); meleemanager = gameObject.GetComponentInChildren<MeleeManager>(); GameObject gameGameObject = GameObject.FindGameObjectWithTag( "Level" ); level = gameGameObject.GetComponent<LevelInfo>(); }
protected virtual void Awake() { if (!sr) sr = GetComponent<SpriteRenderer>(); if (!cp) cp = GetComponent<CircleCollider2D>(); if (!a) a = GetComponent<Animator>(); if (!ri) ri = GetComponent<Rigidbody2D>(); if (!SA) SA = GetComponentInChildren<SkeletonAnimation>(); if (SA) OriginalTimeScale = SA.timeScale; }
// Start is called before the first frame update void Start() { runtimeAtlasAsset = AtlasAsset.CreateRuntimeInstance(atlasText, textures, materialPropertySource, true); runtimeSkeletonDataAsset = SkeletonDataAsset.CreateRuntimeInstance(skeletonJson, runtimeAtlasAsset, true); runtimeSkeletonDataAsset.GetSkeletonData(false); // preload. runtimeSkeletonAnimation = SkeletonAnimation.NewSkeletonAnimationGameObject(runtimeSkeletonDataAsset); // Extra Stuff runtimeSkeletonAnimation.Initialize(false); runtimeSkeletonAnimation.Skeleton.SetSkin("base"); runtimeSkeletonAnimation.Skeleton.SetSlotsToSetupPose(); runtimeSkeletonAnimation.AnimationState.SetAnimation(0, "run", true); runtimeSkeletonAnimation.GetComponent <MeshRenderer>().sortingOrder = 10; runtimeSkeletonAnimation.transform.Translate(Vector3.down * 2); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { SkeletonAnimation anim = animator.GetComponent <SkeletonAnimation>(); if (anim != null) { TrackEntry te = anim.state.SetAnimation(0, animationName, loop); te.timeScale = speed; } SkeletonGraphic sg = animator.GetComponent <SkeletonGraphic>(); if (sg != null) { TrackEntry te = sg.AnimationState.SetAnimation(0, animationName, loop); te.timeScale = speed; } }
public void SetPerformerSkillAnimationOverriden(SkillArtInfo skillInfo, string mode, bool activate) { SkeletonAnimation skillAnimation = unitAnimator.Effects.Find(item => item.name == skillInfo.ArtId); if (skillAnimation != null) { skillAnimation.gameObject.layer = CurrentState.gameObject.layer; skillAnimation.gameObject.SetActive(activate); if (activate) { skillAnimation.Reset(); skillAnimation.state.SetAnimation(0, skillInfo.ArtId + "_" + mode, false).Time = 0; skillAnimation.Update(0); skillAnimation.AnimationName = skillInfo.ArtId + "_" + mode; } } unitAnimator.Animator.SetBool(skillInfo.AnimationId + "_" + mode, activate); }
private SkeletonAnimation CreateSpineAnimation(SkeletonAnimation spinePrefab, Vector2 pos, int sortOrder, string AniName, int aniCount = 1, bool IsLoop = false) { SpineAnimationData data = new SpineAnimationData(); data.ID = IDConter++; SkeletonAnimation copySpine = Instantiate(spinePrefab); data.Drawer = copySpine.gameObject; data.Drawer.transform.position = pos; data.playerAnim = data.Drawer.GetComponent <SkeletonAnimation>(); data.playerAnim.SetSortingOrder(sortOrder); playList.Add(data.ID, data); SetAnmation(data.ID, AniName, aniCount, IsLoop); return(data.playerAnim); }
public override void OnEnter() { var go = Fsm.GetOwnerDefaultTarget(gameObject); _skeletonAnimation = go.GetComponent <SkeletonAnimation>(); if (go == null) { Finish(); } DoSpineChange(); if (!everyframe.Value) { Finish(); } }
// Use this for initialization void Start() { AudioSource[] audioSources = GetComponents <AudioSource>(); eldaAudioSource = audioSources[0]; presidentAudioSource = audioSources[1]; spaceAudioSource = audioSources[2]; sunAudioSource = audioSources[3]; typingAudioSource = audioSources[4]; shutDownAudioSource = audioSources[5]; spaceAudioSource.Play(); sunHeroSkeleton = sunHero.GetComponent <SkeletonAnimation>(); presidentSkeleton = president.GetComponent <SkeletonAnimation>(); startText.SetTextTo("Yesterday...", timeBetweenLettersStartText, secBeforeFadeInSun, true); StartCoroutine(ShowCamerasAtTheSun(2.5f, 2f)); }
public void ReloadSpineSync(string spineName, string fullZipPath) { if (CurSpineName == spineName) { return; } if (SkeletonAnim) { Destroy(SkeletonAnim.gameObject); } SkeletonAnim = SpineZipReader.CreateSkeAnimFromZip(fullZipPath); SkeletonAnim.name = spineName; SkeletonAnim.loop = true; SkeletonAnim.transform.parent = SpineRoot; SkeletonAnim.AnimationName = ToolManager.Instance.DefaultAnim; }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { SkeletonAnimation anim = animator.GetComponent <SkeletonAnimation>(); anim.state.TimeScale = 0; Debug.Log("ShowLevelNow"); for (int i = 0; i < animator.gameObject.GetComponent <CanvasElementsReference> ().ElementsToSetActive.Length; i++) { //animator.gameObject.GetComponent<CanvasElementsReference> ().ElementsToSetActive [i].SetActive (true); } LoadingAnimator.SetTrigger("Loaded"); Destroy(animator.gameObject); }
public void BindToTargetUnit(FormationUnit unit, SkeletonAnimation animation, string boneName) { followUnit = unit; followBoneName = boneName; gameObject.SetActive(true); follower.SkeletonRenderer = animation; currentTransform.SetParent(unit.RectTransform, false); follower.followBoneRotation = false; follower.followZPosition = true; follower.bone = animation.Skeleton.FindBone(boneName); follower.DoUpdate(); follower.enabled = false; Destroy(follower); skeletonAnimation.MeshRenderer.sortingOrder = animation.MeshRenderer.sortingOrder + 1; }
// Token: 0x0600BE84 RID: 48772 RVA: 0x00353830 File Offset: 0x00351A30 public void PlayAnimation(SkeletonAnimation skeletonAnimation, string animationName, bool isLoop) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_PlayAnimationSkeletonAnimationStringBoolean_hotfix != null) { this.m_PlayAnimationSkeletonAnimationStringBoolean_hotfix.call(new object[] { this, skeletonAnimation, animationName, isLoop }); return; } BJLuaObjHelper.IsSkipLuaHotfix = false; skeletonAnimation.AnimationName = string.Empty; skeletonAnimation.loop = isLoop; skeletonAnimation.AnimationName = animationName; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { LoadingAnimator = GameObject.FindGameObjectWithTag("LoadingText").GetComponent <Animator> (); SkeletonAnimation anim = animator.GetComponent <SkeletonAnimation>(); int y = Random.Range(0, 7); if (y == 0) { animationName = "Apple"; } if (y == 1) { animationName = "Pomegranate"; } if (y == 2) { animationName = "Strawberry"; } if (y == 3) { animationName = "Pear"; } if (y == 4) { animationName = "Papaya"; } if (y == 5) { animationName = "Papaya"; } if (y == 6) { animationName = "Kiwi"; } if (y == 7) { animationName = "Grapes"; } anim.state.SetAnimation(0, animationName, true).timeScale = speed; float x = anim.state.GetCurrent(0).AnimationEnd; Debug.Log(x.ToString()); }
// Update is called once per frame void Update() { if (action.Walk && !status.IsFreezing && !status.IsAttacking) { transform.Translate(new Vector3(-data.MoveSpeed * Time.deltaTime * 0.006f, 0, 0)); } if (status.IsFreezing) { if (isSpineAnim) { if (anim == null) { anim = transform.GetComponent <SkeletonAnimation> (); } anim.timeScale = 0f; } else { animator.speed = 0; } } //else //{ // animator.speed = 1; //} if (action.Dead) { if (isSpineAnim) { if (anim == null) { anim = transform.GetComponent <SkeletonAnimation> (); } anim.timeScale = 1; } else { animator.speed = 1; } } OnUpdate(); }
/// <summary> /// 换装备并且合并材质球 /// </summary> /// <param name="skeletonAnimation">spine 组件</param> /// <param name="atlasAsset"> 图片+atlas 生成的图集文件 </param> /// <param name="regionName"> 图集文件中的具体的一张图片 最好一个图片一个图集 </param> /// <param name="e"> 装备类型 </param> public void ExchangeEquipmentAndMerge(SkeletonAnimation skeletonAnimation, List <EquipmentItem> infos) { for (int i = 0; i < infos.Count; i++) { EquipmentItem info = infos[i]; string regionName = info.equipmentImageName; string defaultSkinName = info.defaultSkinName; string spineEquipmentType = info.spineEquipmentTypeName; AssetBundlePackage assetbundle = HFResourceManager.Instance.LoadAssetBundleFromFile(info.equipmentAssetbundleName); AtlasAsset atlasAsset = assetbundle.LoadAssetWithCache <AtlasAsset>(info.equipmentAtlasAssetName); float scale = skeletonAnimation.skeletonDataAsset.scale; Atlas atlas = atlasAsset.GetAtlas(); AtlasRegion region = atlas.FindRegion(regionName); Slot slot = skeletonAnimation.skeleton.FindSlot(info.slotName); Attachment originalAttachment = slot.Attachment; if (region == null) { slot.Attachment = null; } else if (originalAttachment != null) { slot.Attachment = originalAttachment.GetRemappedClone(region, true, true, 1); } else { var newRegionAttachment = region.ToRegionAttachment(region.name, scale); slot.Attachment = newRegionAttachment; } slot.Skeleton.Skin.SetAttachment(slot.Data.Index, info.slotPlaceholderName, slot.Attachment); } Skin repackedSkin = new Skin(RepackConst); repackedSkin.Append(skeletonAnimation.Skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders) repackedSkin.Append(skeletonAnimation.Skeleton.Skin); // Include your new custom skin. Texture2D runtimeAtlas = null; Material runtimeMaterial = null; repackedSkin = repackedSkin.GetRepackedSkin(RepackConst, skeletonAnimation.SkeletonDataAsset.atlasAssets[0].materials[0], out runtimeMaterial, out runtimeAtlas); // Pack all the items in the skin. skeletonAnimation.Skeleton.SetSkin(repackedSkin); // Assign the repacked skin to your Skeleton. skeletonAnimation.skeleton.SetSlotsToSetupPose(); // Use the pose from setup pose. skeletonAnimation.Update(0); // Use the pose in the currently active animation. }
public void PlayAnimation(string animationClipName, System.Action onAnimationComplete = null) { if (isSpineAnim) { if (anim == null) { anim = transform.GetComponent <SkeletonAnimation> (); } playAnimSpine(animationClipName, onAnimationComplete); } else { CreateBullet(); animator.Play(animationClipName, 0, 0); Master.WaitAndDo(0.01f, () => { StartCoroutine(DetectAnimationOnComplete(onAnimationComplete)); }, this); } }
//void OnEnable() //{ // skeletonAnimation.UpdateComplete += ApplyRootMotion; // skeletonAnimation.UpdateLocal += UpdateBones; // skeletonAnimation.state.Start += HandleStart; // //skeletonAnimation.state.End += HandleEnd; //} //void OnDisable() //{ // skeletonAnimation.UpdateComplete -= ApplyRootMotion; // skeletonAnimation.UpdateLocal -= UpdateBones; // skeletonAnimation.state.Start -= HandleStart; // //skeletonAnimation.state.End -= HandleEnd; //} void Awake() { if (!skeletonAnimation) { skeletonAnimation = GetComponentInChildren <SkeletonAnimation>(); } if (!skeletonAnimation) { Debug.LogError("skeletonAnimation is null"); } if (!skeletonAnimation) { return; } rootBoneIndex = skeletonAnimation.Skeleton.FindBoneIndex(skeletonAnimation.skeleton.RootBone.Data.Name); }
public void OnMouseDown() { SkeletonAnimation skeletonAnimation = GetComponent <SkeletonAnimation>(); skeletonAnimation.skeleton.SetSkin(girlSkin ? "goblin" : "goblingirl"); skeletonAnimation.skeleton.SetSlotsToSetupPose(); girlSkin = !girlSkin; if (girlSkin) { skeletonAnimation.skeleton.SetAttachment("right hand item", null); skeletonAnimation.skeleton.SetAttachment("left hand item", "spear"); } else { skeletonAnimation.skeleton.SetAttachment("left hand item", "dagger"); } }
public void Initialize(CharacterBattleMode mode, Hero hero, TapBattleController controller = null) { this.mode = mode; this.hero = hero; this.controller = controller; Character_Spine_Animator = GetComponent <SkeletonAnimation>(); animator = GetComponent <Animator>(); /* * GetWeaponBone weaponBone = GetComponent<GetWeaponBone>(); * * if (weaponBone != null) { * Sprite weaponSprite = Resources.Load<Sprite>("Items/Weapon/" + hero.EquipedItems[EquipmentType.Weapon].data.Sprite); * weaponBone.Initialize(weaponSprite); * } */ initialized = true; }
void UpdateLocal(SkeletonAnimation anim) { if (needToReprocessBones) { CollectBones(); } if (utilityBones == null) { return; } foreach (SkeletonUtilityBone b in utilityBones) { b.transformLerpComplete = false; } UpdateAllBones(); }
public void Initialize(Hero hero) { this.hero = hero; Character_Spine_Animator = GetComponent <SkeletonAnimation>(); animator = GetComponent <Animator>(); /* * GetWeaponBone weaponBone = GetComponent<GetWeaponBone>(); * if (weaponBone != null) { * Sprite weaponSprite = Resources.Load<Sprite>("Items/Weapon/" + hero.EquipedItems[EquipmentType.Weapon].data.Sprite); * weaponBone.Initialize(weaponSprite); * } */ SkillChargingEffect = Instantiate(Resources.Load <GameObject>("Effects/skill-charge")); SkillChargingEffect.transform.SetParent(this.transform); SkillChargingEffect.transform.localPosition = new Vector3(0f, 0.25f, 0f); SkillChargingEffect.SetActive(false); }
// Use this for initialization void Start() { controller = GetComponent <Controller2D>(); audio = GetComponent <AudioSource> (); scale = transform.localScale; // Ok we should get gravity and jumpVelocity from jumpHeight and timeToJumpApex // For gravity we will use the motion equation: delta(Movement) = v0 * time + (acceleration * time^2) / 2 // in our case v0 = 0, time = timeToJumpApex, and delta(Movement) = jumpHeight... // so gravity = 2 * jumpHeight / timeToJumpApex^2 gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); // we added a "-" because we want it to be negative // Now we should get jump velocity from: velocity = v0 + acceleration * time jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; // Debug.Log("gravity: " + gravity + "; jumpVelocity: " + jumpVelocity); spineAnim = GetComponent <SkeletonAnimation>(); spineAnim.Reset(); spineAnim.state.SetAnimation(0, "idle", true); curr_anim = "idle"; }
public void SetSkin(int type,int power = -1) { render = transform.GetChild (0).GetComponent<SkeletonAnimation> (); render.enabled = true; string skinName = "item" + (type + 1).ToString (); if (power != -1) skinName = SetSkin_Power (power, skinName); if (render.skeleton.data.FindSkin (skinName) != null) { render.skeleton.SetSkin (skinName); } else { render.skeleton.SetSkin ("item8"); //if invalid skin name, fall to this skin } render.gameObject.transform.localScale = Vector3.one; render.enabled = false; }
IEnumerator Start() { if (skeletonDataAsset == null) { yield break; } skeletonDataAsset.GetSkeletonData(false); // Preload SkeletonDataAsset. yield return(new WaitForSeconds(1f)); // Pretend stuff is happening. var spineAnimation = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation); for (int i = 0; i < count; i++) { var sa = SkeletonAnimation.NewSkeletonAnimationGameObject(skeletonDataAsset); // Spawn a new SkeletonAnimation GameObject. DoExtraStuff(sa, spineAnimation); // optional stuff for fun. sa.gameObject.name = i.ToString(); yield return(new WaitForSeconds(1f / 8f)); } }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { ScriptPlayable <SpineAnimatorPlayableBehaviour> playable = ScriptPlayable <SpineAnimatorPlayableBehaviour> .Create(graph, new SpineAnimatorPlayableBehaviour()); SpineAnimatorPlayableBehaviour clone = playable.GetBehaviour(); SpineAnimatorTrackMixer trackMixer = TimelineUtils.GetTrackMixer <SpineAnimatorTrackMixer>(graph, _parentAnimatorTrack); clone._clipAsset = this; if (trackMixer != null && trackMixer.GetTrackBinding() != null && !string.IsNullOrEmpty(_animationId)) { SkeletonAnimation skeletonAnimation = trackMixer.GetTrackBinding(); clone._animation = skeletonAnimation.skeletonDataAsset.GetAnimationStateData().SkeletonData.FindAnimation(_animationId); clone._animationSpeed = _animationSpeed; } return(playable); }
void Start() { body = GetComponent <Rigidbody>(); footCollider.enabled = false; skeletonFish.gameObject.SetActive(false); skeletonBird.gameObject.SetActive(false); skeletonActive = skeletonCat; skeletonActive.AnimationState.SetAnimation(0, "run", true); timerController = FindObjectOfType <TimerController>(); transform.position = new Vector3(0, groundHeight, 0); body.velocity = Vector3.right * horizontalSpeed; fixedHeight = groundHeight; }
public void SetAnimation(string anim, bool loop = true, SkeletonAnimation skelAnim = null, int layer = 0) { if (skelAnim == null) { skelAnim = CharSpine.skeletonAnimation; } var track = skelAnim.state.GetCurrent(0); if (track != null) { if (track.Animation.Name == anim) { return; } } skelAnim.state.SetAnimation(layer, anim, loop); }
// ========================================================================== // /* public - [Do] Function * 외부 객체가 호출(For External class call)*/ public void DoSetAlphaRenderer(float fAlpha) { if (_pSkeleton == null) { if (_pAnimation == null) { _pAnimation = GetComponentInChildren <SkeletonAnimation>(); } _pSkeleton = _pAnimation.skeleton; } if (_pSkeleton != null) { Color pColor = _pSkeleton.GetColor(); pColor.a = fAlpha; _pSkeleton.SetColor(pColor); } }
public void ReloadSpine(string curSpineName, string fullZipPath) { if (SkeletonAnim) { Destroy(SkeletonAnim.gameObject); } foreach (Transform child in SpineRoot.transform) { Destroy(child.gameObject); } CurSpineName = curSpineName; SkeletonAnim = SpineZipReader.CreateSkeAnimFromZip(fullZipPath); SkeletonAnim.name = curSpineName; SkeletonAnim.loop = true; SkeletonAnim.transform.parent = SpineRoot; SkeletonAnim.AnimationName = ToolManager.Instance.DefaultAnim; }
void CreatePreviewInstances() { this.DestroyPreviewInstances(); if (warnings.Count > 0) { m_skeletonDataAsset.Clear(); return; } var skeletonDataAsset = (SkeletonDataAsset)target; if (skeletonDataAsset.GetSkeletonData(false) == null) { return; } if (this.m_previewInstance == null) { string skinName = EditorPrefs.GetString(m_skeletonDataAssetGUID + "_lastSkin", ""); try { m_previewInstance = SpineEditorUtilities.InstantiateSkeletonAnimation(skeletonDataAsset, skinName).gameObject; if (m_previewInstance != null) { m_previewInstance.hideFlags = HideFlags.HideAndDontSave; m_previewInstance.layer = 0x1f; m_skeletonAnimation = m_previewInstance.GetComponent <SkeletonAnimation>(); m_skeletonAnimation.initialSkinName = skinName; m_skeletonAnimation.LateUpdate(); m_skeletonData = m_skeletonAnimation.skeletonDataAsset.GetSkeletonData(true); m_previewInstance.GetComponent <Renderer>().enabled = false; m_initialized = true; } AdjustCameraGoals(true); } catch { DestroyPreviewInstances(); } } }
// Token: 0x0600BE81 RID: 48769 RVA: 0x0035367C File Offset: 0x0035187C public void SummonHeroTeamShow() { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_SummonHeroTeamShow_hotfix != null) { this.m_SummonHeroTeamShow_hotfix.call(new object[] { this }); return; } BJLuaObjHelper.IsSkipLuaHotfix = false; this.m_task.CustomLoadAsset(delegate { foreach (BusinessCardHeroSet businessCardHeroSet in this.m_playerContext.BusinessCard.SetInfo.Heroes) { Hero hero = this.m_playerContext.GetHero(businessCardHeroSet.HeroId); string heroModelAssetPath = UIUtility.GetHeroModelAssetPath(hero); this.m_task.CollectAssetWrap(heroModelAssetPath); } }, delegate { int num = 0; while (num < this.m_playerContext.BusinessCard.SetInfo.Heroes.Count && num < this.m_charGroupNode.transform.childCount) { BusinessCardHeroSet businessCardHeroSet = this.m_playerContext.BusinessCard.SetInfo.Heroes[num]; Hero hero = this.m_playerContext.GetHero(businessCardHeroSet.HeroId); string heroModelAssetPath = UIUtility.GetHeroModelAssetPath(hero); GameObject asset = AssetUtility.Instance.GetAsset <GameObject>(heroModelAssetPath); Transform child = this.m_charGroupNode.transform.GetChild(num); GameObject gameObject = GameObjectUtility.CloneGameObject(asset, child); EventTriggerListener eventTriggerListener = gameObject.AddComponent <EventTriggerListener>(); eventTriggerListener.onClick = (EventTriggerListener.VoidDelegate)Delegate.Combine(eventTriggerListener.onClick, new EventTriggerListener.VoidDelegate(this.OnCharClick)); SkeletonAnimation component = gameObject.GetComponent <SkeletonAnimation>(); this.PlayAnimation(component, businessCardHeroSet.Action, true); this.SetCharDirection(child.gameObject, businessCardHeroSet.Direction == HeroDirectionType.Right); this.m_roleSkeletonList.Add(gameObject.GetComponent <SkeletonAnimation>()); num++; } this.m_charGroupNode.transform.position = this.arPlaneTrace.centerPos; this.m_charGroupNode.transform.rotation = this.arPlaneTrace.centerRotation; }); }
public static SkeletonAnimation SpawnAnimatedSkeleton(SkeletonDataAsset skeletonDataAsset, Skin skin = null) { GameObject go = new GameObject(skeletonDataAsset.name.Replace("_SkeletonData", ""), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkeletonAnimation)); SkeletonAnimation anim = go.GetComponent <SkeletonAnimation>(); anim.skeletonDataAsset = skeletonDataAsset; bool requiresNormals = false; foreach (Material m in anim.skeletonDataAsset.atlasAsset.materials) { if (m.shader.name.Contains("Lit")) { requiresNormals = true; break; } } anim.calculateNormals = requiresNormals; if (skin == null) { skin = skeletonDataAsset.GetSkeletonData(true).DefaultSkin; } if (skin == null) { skin = skeletonDataAsset.GetSkeletonData(true).Skins[0]; } anim.Reset(); anim.skeleton.SetSkin(skin); anim.initialSkinName = skin.Name; anim.skeleton.Update(1); anim.state.Update(1); anim.state.Apply(anim.skeleton); anim.skeleton.UpdateWorldTransform(); return(anim); }
/// <summary> /// /// </summary> /// <param name="asset"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="anchor"></param> /// <param name="cloneMaterial"></param> public void SetSpine(SkeletonDataAsset asset, int width, int height, Vector2 anchor, bool cloneMaterial) { if (_spineAnimation != null) { FreeSpine(); } _spineAnimation = SkeletonRenderer.NewSpineGameObject <SkeletonAnimation>(asset); _spineAnimation.gameObject.name = asset.name; Spine.SkeletonData dat = asset.GetSkeletonData(false); _spineAnimation.gameObject.transform.localScale = new Vector3(1 / asset.scale, 1 / asset.scale, 1); _spineAnimation.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0); SetWrapTarget(_spineAnimation.gameObject, cloneMaterial, width, height); _spineAnimation.skeleton.R = _color.r; _spineAnimation.skeleton.G = _color.g; _spineAnimation.skeleton.B = _color.b; OnChangeSpine(null); }
void OnEnable(){ if(skeletonRenderer == null){ skeletonRenderer = GetComponent<SkeletonRenderer>(); } if(skeletonAnimation == null){ skeletonAnimation = GetComponent<SkeletonAnimation>(); } skeletonRenderer.OnReset -= HandleRendererReset; skeletonRenderer.OnReset += HandleRendererReset; if(skeletonAnimation != null){ skeletonAnimation.UpdateLocal -= UpdateLocal; skeletonAnimation.UpdateLocal += UpdateLocal; } CollectBones(); }
void Start() { GameManager.instance.onPauseGame += Instance_onPauseGame; if (!ani) ani = GetComponent<SkeletonAnimation>(); if (!ani) ani = GetComponentInChildren<SkeletonAnimation>(); if (!ani) { enabled = false; return; } startingTimeScale = ani.timeScale; }
void Start () { GameObject.FindGameObjectWithTag("Audio").transform.GetComponent<AudioSource>().mute = true; sprites = new int[setSize]; SetZero(); tpc = GameObject.FindGameObjectWithTag("TapCounter"); imageSet = new GameObject[setSize]; Set(setSize); num = (int)Random.Range(0, imageSet.Length); print(num); InvokeRepeating("Flash", 0, time); //num = (int)Random.Range(0, images.Length); skeletonAnimation = GameObject.FindGameObjectWithTag("animation").GetComponent<SkeletonAnimation>(); skeletonAnimation.enabled = false; gameOv = GameObject.FindGameObjectWithTag("GameOver").GetComponent<SkeletonAnimation>(); gameOv.enabled = false; gmv = GameObject.FindGameObjectWithTag("GameOver"); skla = GameObject.FindGameObjectWithTag("animation"); }
public void ChangeFacingDirection(FaceDirection direction) { animState = AnimationState.Turn; _unit._facingDirection = direction; if (direction == FaceDirection.Up) { _anim = backSkelAnim; _anim.gameObject.transform.localScale = new Vector3(1, 1, 1); frontSkelAnim.gameObject.SetActive(false); backSkelAnim.gameObject.SetActive(true); //print("Up"); } else if (direction == FaceDirection.Right) { _anim = frontSkelAnim; _anim.gameObject.transform.localScale = new Vector3(-1, 1, 1); frontSkelAnim.gameObject.SetActive(true); backSkelAnim.gameObject.SetActive(false); // print("Right"); } else if(direction == FaceDirection.Down) { _anim = frontSkelAnim; _anim.gameObject.transform.localScale = new Vector3(1, 1, 1); frontSkelAnim.gameObject.SetActive(true); backSkelAnim.gameObject.SetActive(false); // print("Down"); } else if (direction == FaceDirection.Left) { _anim = backSkelAnim; _anim.gameObject.transform.localScale = new Vector3(-1, 1, 1); frontSkelAnim.gameObject.SetActive(false); backSkelAnim.gameObject.SetActive(true); // print("Left"); } }
void Start () { game = GameObject.Find ("Gui").GetComponent<GameHandler> (); boxCollider = GetComponent<BoxCollider2D> (); character = GetComponent<MeshRenderer> (); controller = GetComponent<Controller2D> (); anim = GetComponent<SkeletonAnimation> (); skeleton = anim.skeleton; arm = skeleton.FindBone ("RShoulder"); backArm = skeleton.FindBone ("LShoulder"); weap = skeleton.FindBone ("Weapon"); skelRend = GetComponent<SkeletonRenderer> (); skeleton.FindSlot ("WeaponImage").Attachment = null; anim.state.ClearTrack(1); controller.CatchPlayer (this); crouchTap = new TapInfo (.6f, int.MaxValue); dashTap = new TapInfo (.6f, int.MaxValue); //Initiate the width of the HP bar, this may need to be placed in the Update portion if window scaling is changed. width = healthbar.GetComponent<RectTransform>().rect.width; startMaxXPos = healthbar.GetComponent<RectTransform>().offsetMax.x; UpdateGravity(); }