// Use this for initialization void Start() { UnityArmatureComponent unityArmature = GetComponent <UnityArmatureComponent>(); UnityFactory.factory.autoSearch = true; UnityFactory.factory.ReplaceSlotDisplay( dragonBonesName, armatureName, slotName, displayName, unityArmature.armature.GetSlot(replaceSlot), replaceTex, new Material(Shader.Find("Sprites/Default")) ); }
void Awake() { _armature = GetComponent <UnityArmatureComponent>(); /*render = GetComponent<SpriteRenderer>(); * if(render == null) * { * Debug.LogError("No sprite renderer in player character."); * }*/ }
private void Start() { character = GetComponent <UnityArmatureComponent>(); healthBar.SetMaxHealth(monster.totalHealth); healthBar.SetHealth(monster.totalHealth); currentHealth = monster.totalHealth; Monster.OnReceiveDmg += TakeDamage; }
void Start() { onGround = true; standRotation = Quaternion.Euler(0f, 0f, 0f); rb = GetComponent <Rigidbody2D> (); armature = GetComponentInChildren <UnityArmatureComponent> (); TIM = FindObjectOfType <TouchInputMovement> (); m_SFXPlayer = FindObjectOfType <SFXPlayer> (); m_MusicPlayer = FindObjectOfType <MusicPlayer> (); }
private void InitializeComponent() { rigid = this.gameObject.GetComponent <Rigidbody2D>(); // pGraphic 이엿음 //spr = this.transform.Find("playerGHP").GetComponent<SpriteRenderer>(); //anim = this.transform.Find("playerGHP").GetComponent<Animator>(); pArmature = this.transform.Find("PlayerArmature").GetComponent <UnityArmatureComponent>(); coll = this.GetComponent <Collider2D>(); curObj = null; isFacedR = true; }
private void InitAnimations() { UnityFactory.factory.LoadDragonBonesData(charModel + "/" + charModel + "_ske"); UnityFactory.factory.LoadTextureAtlasData(charModel + "/" + charModel + "_tex"); animComponent = UnityFactory.factory.BuildArmatureComponent(charModel); animComponent.transform.localPosition = transform.position; animComponent.transform.localScale = transform.localScale * charScale; animComponent.transform.parent = transform; }
void PlayAnimatorByIndex(int index) { GameObject animateObj = discountobj.transform.Find("ImageBG"). Find("LeftButton").Find("ImageViewport").Find("Content"). Find("Anime_" + index.ToString()).gameObject; UnityArmatureComponent animate = ((GameObject)discountAnimate).GetComponent <UnityArmatureComponent>(); discountAnimate.transform.SetParent(animateObj.transform, false); animate.animation.Play("newAnimation"); }
// Use this for initialization void Start() { Vector2 min = Camera.main.ViewportToWorldPoint(new Vector2(0, 0)); Vector2 max = Camera.main.ViewportToWorldPoint(new Vector2(1, 1)); Player.print("width:" + min.x + " , " + max.x); Player.print("height:" + min.y + " , " + max.y); //StartCoroutine(initPlayers()); // SpriteRenderer spriteRenderer = GetComponent<Renderer>() as SpriteRenderer; int charIndex = 0; for (int i = 0; i < BasicPlayerInfo.instance.CharacterDiscription.Length; i++) { if (role == BasicPlayerInfo.instance.CharacterDiscription[i]) { charIndex = i; break; } } //if (role == "ninja") // spriteRenderer.sprite = sprites[0]; // else if (role == "hunter") // spriteRenderer.sprite = sprites[1]; // else if (role == "enchanter") // spriteRenderer.sprite = sprites[2]; // else if (role == "thief") // spriteRenderer.sprite = sprites[3]; CmdInitializeAll(); maincamera = Camera.main; m_RigidBody2D = GetComponent <Rigidbody2D>(); armatureComponent = GetComponent <UnityArmatureComponent>(); Player.print("eyes" + eyes + "char" + charIndex + "skin" + skin); BasicPlayerInfo.UpdateEyes(eyes, armatureComponent); BasicPlayerInfo.UpdateChar(charIndex, armatureComponent); BasicPlayerInfo.UpdateColor(skin, armatureComponent); int index = 1; GameObject[] objs = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject gameObj in objs) { Player p = gameObj.GetComponent <Player>(); p.GetComponent <UnityArmatureComponent>().transform.position = new Vector3(0.0f, 0.0f, -15.0f + index); index++; if (p.isLocalPlayer) { armatureComponent.transform.position = new Vector3(0.0f, 0.0f, -15.0f); } } items = new List <string>(); speedmul = 15f; initPlayers(); // Warning!!!! make all character's slot as 1 slots = 1; }
private void Start() { Battle.OnHeroAttack += Attack; UnityArmatureComponent character = GetComponent <UnityArmatureComponent>(); maxHealth = hero.hp; currentHealth = maxHealth; healthBar.SetMaxHealth(maxHealth); healthBar.SetHealth(maxHealth); }
private static readonly string[] WEAPON_RIGHT_LIST = { "weapon_1004_r", "weapon_1004b_r", "weapon_1004c_r", "weapon_1004d_r", "weapon_1004e_r" }; //换装武器的图片名称数组 // Start is called before the first frame update void Start() { _armatureComp = GetComponent <UnityArmatureComponent>(); //定义龙骨骨架 _armatureComp.animation.Play("idle"); //播放待机动画 _armatureComp.debugDraw = true; //显示骨架和包围盒线段 // Load Right Weapon Data UnityFactory.factory.LoadDragonBonesData("weapon_1004_show/weapon_1004_show_ske"); //加载武器龙骨数据到缓存 UnityFactory.factory.LoadTextureAtlasData("weapon_1004_show/weapon_1004_show_tex"); //加载武器龙骨数据到缓存 _tailWeaponSlot = _armatureComp.armature.GetSlot("weapon"); //定义要换装武器图片的插槽 _tailWeaponIndex = 0; //换装武器编号初始化 }
public Animation(UnityArmatureComponent horizontalArmature, UnityArmatureComponent verticalArmature) { _horizontalArmature = horizontalArmature; _verticalArmature = verticalArmature; currentArmature = _verticalArmature; disableArmature = _horizontalArmature; disableArmature.gameObject.SetActive(false); currentArmature.gameObject.SetActive(true); KeyboardInput.Instance.OnInput += UpdateMovement; }
protected override void OnStart() { // Load body this._LoadData("you_xin/body/body_ske", "you_xin/body/body_tex"); // Load suits var dragonBonesJSONPath = ""; var textureAtlasJSONPath = ""; foreach (var suitName in this._suitConfigs.Keys) { var parts = this._suitConfigs[suitName]; foreach (var partArmatureName in parts) { //you_xin/suit1/2010600a/2010600a_ske dragonBonesJSONPath = "you_xin/" + suitName + "/" + partArmatureName + "/" + partArmatureName + "_ske"; //you_xin/suit1/2010600a/2010600a_tex textureAtlasJSONPath = "you_xin/" + suitName + "/" + partArmatureName + "/" + partArmatureName + "_tex"; // this._LoadData(dragonBonesJSONPath, textureAtlasJSONPath); } } // Build body this._bodyArmatureComp = UnityFactory.factory.BuildArmatureComponent("body"); // this._bodyArmatureComp.CloseCombineMeshs(); // this._bodyArmatureComp.transform.localScale = new Vector3(0.5f, 0.5f, 1.0f); this._bodyArmatureComp.transform.localPosition = new Vector3(0.0f, -4.0f, 0.0f); // Add loop complete event listener this._bodyArmatureComp.AddDBEventListener(EventObject.LOOP_COMPLETE, this._OnFrameEventHandler); // Play idle animation this._bodyArmatureComp.animation.Play("idle", 0); // Init the first suit var initSuitIndex = 0; var suitNames = this._suitConfigs.Keys.ToArray(); var initSuitParts = this._suitConfigs[suitNames[initSuitIndex]]; foreach (var part in initSuitParts) { var skin = UnityFactory.factory.GetArmatureData(part); UnityFactory.factory.ReplaceSkin(this._bodyArmatureComp.armature, skin.defaultSkin); } // Replace the sencond suit this._replaceSuitIndex = ++initSuitIndex; this._replaceSuitParts.AddRange(this._suitConfigs[suitNames[initSuitIndex]]); }
public override void BindToContext(Fighter context) { if (context != null) { // Create armature. fighterArmature = UnityFactory.factory.BuildArmatureComponent(armatureName); // Input armature name fighterArmature.transform.SetParent(transform, false); #if UNITY_EDITOR foreach (string name in fighterArmature.animation.animationNames) { Debug.Log(name); } #endif PlayAnimation("Idle"); // Change armature position. fighterArmature.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f); context.OnHitpointsReset += (origin, percent) => { PlayAnimation("Idle"); }; context.OnReceivedDamage += (origin, percent) => { if (origin.CurrentHitpoints <= 0) { PlayAnimation("Dead", 1); } else { PlayAnimation("Damage", 1, () => { PlayAnimation("Idle"); }); } }; context.OnAttack += (origin, damage) => { PlayAnimation("Attack", 1, () => { PlayAnimation("Idle"); }); }; healthView.BindToContext(context); damageView.BindToContext(context); } }
void Start() { hold = false; Player = GameObject.Find("Player"); PM = GameObject.FindObjectOfType <PijakanManagerScript> (); rb = Player.GetComponent <Rigidbody2D> (); minJump = 0f; jumpPressure = 0f; maxJumpPressure = 10f; armature = Player.GetComponentInChildren <UnityArmatureComponent> (); m_SFXPlayer = FindObjectOfType <SFXPlayer> (); LR = Player.GetComponentInChildren <LineRenderer> (); LR.enabled = false; }
void Start() { uac = GetComponentInChildren <UnityArmatureComponent>(); gm = GameObject.Find("GameManager").GetComponent <GameManager>(); player = GameObject.Find("player"); ps = player.GetComponent <Player>(); fabCtrl = GameObject.Find("FabricCtrl").GetComponent <FabricCtrl>(); if (activateOnStart) { Activate(); } dp = GetComponentInChildren <DeathParticles>(); mr = GetComponentsInChildren <MeshRenderer>(); }
// Use this for initialization void Start() { playerBody = GetComponent <Rigidbody2D>(); gd = GetComponentInChildren <GroundDetect>(); dmgScript = GetComponentInChildren <PlayerDamageEnemy>(); scoreScript = GetComponentInChildren <PlayerScoreIncrement>(); cameraScript = GetComponent <CameraFollow>(); armatureComponent = GetComponentInChildren <UnityArmatureComponent>(); lifeBoard.transform.position = new Vector2(20, Screen.height - 10); lifeBoard.text = "Continues: " + lifes; BoardsUpdate(); }
private IEnumerator Animate(KeyFrame frame) { float elapsed = 0; GameObject go = gos[frame.name]; RectTransform rectTransform = dialogs[frame.name].GetComponent <RectTransform>(); if (IS_3D_MODE) { // 改变动画状态机的状态 Animator animator = go.GetComponent <Animator>(); animator.SetTrigger(frame.name); } else { // 播放 DrangonBones 动画 UnityArmatureComponent armatureComp = go.GetComponent <UnityArmatureComponent>(); DragonBones.Animation animation = armatureComp.animation; Dictionary <string, AnimationData> animations = animation.animations; float length = animations[frame.content].duration; if (frame.loop > 0) { animation.timeScale = length / (frame.duration / frame.loop); } else { animation.timeScale = 1; } animation.Play(frame.content, frame.loop); } // 插值改变物体 transform UnityEngine.Transform transform = go.transform; transform.SetPositionAndRotation(frame.StartPosition, frame.StartRotation); transform.localScale = frame.StartScale; while (elapsed < frame.duration) { transform.SetPositionAndRotation( LerpUtility.Linear(frame.StartPosition, frame.EndPosition, elapsed / frame.duration), LerpUtility.Linear(frame.StartRotation, frame.EndRotation, elapsed / frame.duration) ); transform.localScale = LerpUtility.Linear(frame.StartScale, frame.EndScale, elapsed / frame.duration); if (!IS_3D_MODE) { UpdateDialogPos(transform.position, rectTransform); } elapsed += Time.deltaTime; yield return(new WaitForEndOfFrame()); } }
/// <summary> /// /// </summary> /// <param name="asset"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="anchor"></param> public void SetDragonBones(DragonBonesData asset, int width, int height, Vector2 anchor) { if (_armatureComponent != null) { FreeDragonBones(); } _armatureComponent = UnityFactory.factory.BuildArmatureComponent(asset.armatureNames[0], asset.name, null, asset.name); _armatureComponent.gameObject.transform.localScale = new Vector3(100, 100, 1); _armatureComponent.gameObject.transform.localPosition = new Vector3(anchor.x, -anchor.y, 0); SetWrapTarget(_armatureComponent.gameObject, true, width, height); OnChangeDragonBones(null); }
void FadeAnimation(string name, UnityArmatureComponent obj = null, int layer = 0, float fadeTime = 0.1f, int playTimes = -1) { if (obj == null) { obj = anim; } if (obj != null) { if (obj.animation.GetState(name) == null) { obj.animation.FadeIn(name, fadeTime, playTimes, layer); } } }
// Use this for initialization protected override void OnStart() { // Load Mecha Data UnityFactory.factory.LoadDragonBonesData("mecha_1004d/mecha_1004d_ske"); UnityFactory.factory.LoadTextureAtlasData("mecha_1004d/mecha_1004d_tex"); // Build Mecha Armature this._mechaArmatureComp = UnityFactory.factory.BuildArmatureComponent("mecha_1004d"); // this._mechaArmatureComp.AddDBEventListener(EventObject.LOOP_COMPLETE, OnAnimationEventHandler); this._mechaArmatureComp.animation.Play("walk"); this._mechaArmatureComp.transform.localPosition = new Vector3(0.0f, -2.0f, 0.0f); }
// Use this for initialization protected void Start() { //Tools.timeData(); playerRigidbody2D = GetComponent <Rigidbody2D>(); DBBody = GetComponentInChildren <UnityArmatureComponent>(); //DBBody.AddEventListener(DragonBones.FrameEvent.MOVEMENT_FRAME_EVENT, this.onMOVEMENTBoneEvent, this); DBBody.AddDBEventListener(DragonBones.EventObject.FRAME_EVENT, this.ShowACTX); DBBody.AddDBEventListener(DragonBones.EventObject.SOUND_EVENT, this.ShowACTX); roleDate = GetComponent <RoleDate>(); //DBBody.AddDBEventListener(EventObject.FRAME_EVENT, this.test); DBBody.AddDBEventListener("atks", this.Test); bodyScale = new Vector3(1, 1, 1); vOAtk = GetComponent <VOAtk>(); this.transform.localScale = bodyScale; }
// Use this for initialization void Start() { UnityFactory.factory.LoadDragonBonesData(dragonBonesJSON); UnityFactory.factory.LoadTextureAtlasData(textureAtlasJSONPath); // Build Mecha Armature this._mechaArmatureComp = UnityFactory.factory.BuildArmatureComponent(armatureName); //Set position this._mechaArmatureComp.transform.localPosition = localPosition; this._mechaArmatureComp.transform.localScale = new Vector3(scale, scale, scale); // Add animation event listener //this._mechaArmatureComp.AddDBEventListener(EventObject.COMPLETE, this.OnAnimationEventHandler); this._mechaArmatureComp.animation.Play(animationMethod); }
void Start() { _armatureComponent = GetComponent <UnityArmatureComponent>(); _armatureComponent.AddEventListener(EventObject.FADE_IN_COMPLETE, AnimationEventHandler); _armatureComponent.AddEventListener(EventObject.FADE_OUT_COMPLETE, AnimationEventHandler); _animState = _armatureComponent.animation.FadeIn("idle"); _rigidBody = GetComponent <Rigidbody2D>(); _rigidBody.freezeRotation = true; _rigidBody.gravityScale = GameDefine.GravityScale; _BBCollider = GetComponent <BoxCollider2D>(); PlayerInputManager.Instance.AddLeftJoystickListoner(LeftJoystickHandler); PlayerInputManager.Instance.AddButtonCommandListoner(ButtonCommandHandler); }
void Awake() { // Clear this._bodyArmatureComp = null; this._replaceSuitIndex = 0; this._suitConfigs.Clear(); this._replaceSuitParts.Clear(); // Init suit1 var suit1 = new List <string>(); suit1.Add("2010600a"); suit1.Add("2010600a_1"); suit1.Add("20208003"); suit1.Add("20208003_1"); suit1.Add("20208003_2"); suit1.Add("20208003_3"); suit1.Add("20405006"); suit1.Add("20509005"); suit1.Add("20703016"); suit1.Add("20703016_1"); suit1.Add("2080100c"); suit1.Add("2080100e"); suit1.Add("2080100e_1"); suit1.Add("20803005"); suit1.Add("2080500b"); suit1.Add("2080500b_1"); this._suitConfigs.Add("suit1", suit1); // Init suit2 var suit2 = new List <string>(); suit2.Add("20106010"); suit2.Add("20106010_1"); suit2.Add("20208006"); suit2.Add("20208006_1"); suit2.Add("20208006_2"); suit2.Add("20208006_3"); suit2.Add("2040600b"); suit2.Add("2040600b_1"); suit2.Add("20509007"); suit2.Add("20703020"); suit2.Add("20703020_1"); suit2.Add("2080b003"); suit2.Add("20801015"); this._suitConfigs.Add("suit2", suit2); }
void Start() { armatureComponent = transform.GetComponentInChildren <UnityArmatureComponent>(); playerMovement = transform.GetComponent <PlayerMovement>(); characterController2D = transform.GetComponent <CharacterController2D>(); totoSkills = transform.GetComponent <TotoSkills>(); normalRunSpeed = playerMovement.runSpeed; foreach (ParticleSystem ps in snowBall) { #pragma warning disable CS0618 // Тип или член устарел ps.enableEmission = false; #pragma warning restore CS0618 // Тип или член устарел } }
public static void UpdateChar(int index, UnityArmatureComponent armatureComponent) { if (!armatureComponent) { return; } string picName = "-deco-" + (++index); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "body-deco", "body" + picName, armatureComponent.armature.GetSlot("body-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "head-deco", "head" + picName, armatureComponent.armature.GetSlot("head-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "lefthand-deco", "lh" + picName, armatureComponent.armature.GetSlot("lefthand-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "righthand-deco", "rh" + picName, armatureComponent.armature.GetSlot("righthand-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "leftthigh-deco", "lt" + picName, armatureComponent.armature.GetSlot("leftthigh-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "leftleg-deco", "ll" + picName, armatureComponent.armature.GetSlot("leftleg-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "rightthigh-deco", "rt" + picName, armatureComponent.armature.GetSlot("rightthigh-deco")); UnityFactory.factory.ReplaceSlotDisplay("cat", "MarvinCat", "rightleg-deco", "rl" + picName, armatureComponent.armature.GetSlot("rightleg-deco")); }
void Start() { //// Load data. //UnityFactory.factory.LoadDragonBonesData("Animations/soldiers_ske"); // DragonBones file path (without suffix) //UnityFactory.factory.LoadTextureAtlasData("Animations/soldiers_tex"); //Texture atlas file path (without suffix) // // Create armature. //var armatureComponent = UnityFactory.factory.BuildArmatureComponent("Armature"); // Input armature name // // Play animation. //armatureComponent.animation.Play("idle"); //// Change armatureposition. //armatureComponent.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f); armatureComponent = GetComponent<UnityArmatureComponent>(); }
private void Start() { audio = GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player"); BGP = GameObject.FindGameObjectWithTag("AIM").GetComponent <BasicGamePlay>(); EnemyArmature = GetComponent <UnityArmatureComponent>(); enemyRG = GetComponent <Rigidbody2D>(); if (isFlipped) { directionToDie = Vector2.left; transform.Rotate(0, 180, 0); } else { directionToDie = Vector2.right; } }
protected override void OnStart() { // Load Mecha Data UnityFactory.factory.LoadDragonBonesData("mecha_1004d/mecha_1004d_ske"); UnityFactory.factory.LoadTextureAtlasData("mecha_1004d/mecha_1004d_tex"); // Build Mecha Armature this._mechaArmatureComp = UnityFactory.factory.BuildArmatureComponent("mecha_1004d"); this._mechaArmatureComp.transform.localPosition = new Vector3(0.0f, -2.0f, 0.0f); // Add animation event listener this._mechaArmatureComp.AddDBEventListener(EventObject.COMPLETE, this.OnAnimationEventHandler); // Add sound event listener UnityFactory.factory.soundEventManager.AddDBEventListener(EventObject.SOUND_EVENT, this.OnSoundEventHandler); this._mechaArmatureComp.ArmAnimation.Play("walk"); }
// Use this for initialization void Start() { //Load Data UnityFactory.factory.LoadDragonBonesData("testAnimation/Rabbit_ske"); UnityFactory.factory.LoadTextureAtlasData("testAnimation/Rabbit_tex"); //Create armature UnityArmatureComponent armatureComponent = UnityFactory.factory.BuildArmatureComponent("Armature"); // UnityArmatureComponent armatureComponent = GetComponent<UnityArmatureComponent>; if (armatureComponent == null) { Debug.Log("BadNews"); } armatureComponent.animation.Play("jump"); armatureComponent.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f); }