Ejemplo n.º 1
0
    void Start()
    {
        _simpleAnimation.CrossFade("walk", 1f);
        _simpleAnimation.CrossFade("jump", 0.2f);

        _simpleAnimation.Play("Default");
    }
    // Update is called once per frame
    void Update()
    {
        Vector2 syoujoPos  = m_syoujo.transform.position;
        Vector2 akuryouPos = gameObject.transform.position;
        Vector2 scale      = transform.localScale;

        base.m_moveSpeed = 2f;
        base.Chase();
        m_shuteCount -= Time.deltaTime;

        if (akuryouPos.x > syoujoPos.x)
        {
            if (scale.x < 0)
            {
                scale.x *= -1f;
            }
        }
        else
        {
            if (scale.x > 0)
            {
                scale.x *= -1f;
            }
        }
        if (m_shuteCount < 0)
        {
            if (akuryouPos.x - syoujoPos.x < 10)
            {
                SoundManager.Instance.PlaySE((int)Common.SEList.FarEnemyAttack);
                m_darkBallDas.m_seCheck = true;
            }
            else if (akuryouPos.x - syoujoPos.x > 10)
            {
                m_darkBallDas.m_seCheck = false;
            }
            m_sim.Play("Attack");
            m_shuteCount = 3f;
            GameObject  obj = Instantiate(m_bulletPrefab, m_spawnPoint.position, m_spawnPoint.rotation);
            Rigidbody2D rb  = obj.GetComponent <Rigidbody2D>();
            rb.AddForce(obj.transform.right * -m_shutePower, ForceMode2D.Impulse);
        }
        if (m_shuteCount < 2)
        {
            m_sim.Play("Default");
        }
        transform.localScale = scale;
        if (damageCheck == false)
        {
            damageCounter -= Time.deltaTime;
        }
        if (damageCounter < 0)
        {
            damageCounter = 1f;
            damageCheck   = true;
        }
    }
 public void PlayWalk()
 {
     if (simpleAnimation.lastAnimName != "walk" ||
         !simpleAnimation.IsRunning())
     {
         simpleAnimation.Play("walk");
         runEffSp.Play();
         //Debug.LogErrorFormat("PlayWalk {0}", idxInTeam);
     }
 }
        public override void Active()
        {
            base.Active();

            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.WanderArrived, OnWanderArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.AnimalPlayLevelUpEffect, OnAnimalPlayLevelUpEffect);

            this.pathWander.Run();
            //this.wander.Run();
            anim.Play(GlobalDataManager.GetInstance().animalAnimation.walkName);
        }
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == ("shinigami") || collision.gameObject.tag == ("syoujo"))
     {
         m_onCollisionStay = true;
         if (m_pushed == false)
         {
             m_pushed = true;
             m_simpleAnimation.Play("Change");
         }
     }
 }
        /// <summary>
        /// 是否是新手引导需要的转圈
        /// </summary>
        /// <param name="goLittleZoo"></param>
        /// <param name="littleZooID"></param>
        private static void IsGuidOpenUIBuildShowPage(GameObject goLittleZoo, int littleZooID)
        {
            if (!GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                return;
            }

            GlobalDataManager.GetInstance().playerData.playerZoo.BuildShowTransform = goLittleZoo.transform;
            float timeCount = 0.1f;

            DOTween.To(() => timeCount, a => timeCount = a, 0.1f, 0.1f).OnComplete(new TweenCallback(delegate
            {
                PageMgr.ShowPage <UIBuildShowPage>(littleZooID);  //旋转视角UI
            }));
            System.Action action = null;
            action?.Invoke();
            var anim = goLittleZoo.GetComponentInChildren <Animation>();

            if (anim != null)
            {
                SimpleAnimation buildingClickSa = new SimpleAnimation();
                buildingClickSa.Init(anim);
                buildingClickSa.Play(Config.globalConfig.getInstace().BuildClickAnim);
            }
        }
    /// <summary>
    /// 处理养成UI点击交互
    /// </summary>
    /// <param name="gameObject">点击对象</param>
    void DisposeUIInteractive(GameObject gameObject)
    {
        nameID = gameObject.name;
        //LogWarp.LogError("AAAAAAAAAAAAAAAAAAAAAAAAAA                "+nameID);

        Action action = null;

        if (clickCallbacks.TryGetValue(gameObject.name, out action))
        {
            sceneUIButtonPos = gameObject.transform;
            action?.Invoke();
            var anim = gameObject.GetComponentInChildren <Animation>();
            if (anim != null)
            {
                buildingClickSa.Init(anim);
                buildingClickSa.Play(Config.globalConfig.getInstace().BuildClickAnim);
            }
            ZooCamera.GetInstance().PointAtScreenUpCenter(gameObject.transform.position);
        }
        //if (gameObject.name == needShowID)
        //{
        //    ZooCamera.GetInstance().PointAtScreenUpCenter(gameObject.transform.position);
        //    MessageString.Send((int)GameMessageDefine.UIMessage_OnClickButHidePart, "UIMainPage");
        //}
    }
Ejemplo n.º 8
0
        protected void TickAnim()
        {
            if (followPath.IsRunning())
            {
                if (anim.lastAnimName != Config.globalConfig.getInstace().VisitorWalk)
                {
                    anim.Play(Config.globalConfig.getInstace().VisitorWalk);
                }

                return;
            }

            if (anim.lastAnimName != Config.globalConfig.getInstace().VisitorIdle)
            {
                anim.Play(Config.globalConfig.getInstace().VisitorIdle);
            }
        }
Ejemplo n.º 9
0
        //  Methods ---------------------------------------------
        public void SetAnimation(int index)
        {
            AnimationClip nextAnimationClip = _animationClips[index];

            _simpleAnimation.Play(nextAnimationClip.name);

            //Debug.Log($"SetAnimation() name={nextAnimationClip.name}.");
        }
Ejemplo n.º 10
0
 // Update is called once per frame
 private void Update()
 {
     if (((int)Time.time) % 3 == 0)
     {
         anim.Stop();
         anim.Play("atk");
     }
 }
            public IEnumerator Test()
            {
                SimpleAnimation.OnStopAsObservable("Move").Subscribe(_ => Assert.Pass());
                SimpleAnimation.Play("Move");
                yield return(new WaitForSeconds(2.0f));

                Assert.Fail();
            }
Ejemplo n.º 12
0
 void Start()
 {
     state = CharaState.Idle;
     humanAnimation.Play("Default"); // 敢えて書いておく
     eggMan.OnJumpTop += JumpTop;
     eggMan.OnJumpEnd += JumpEnd;
 }
Ejemplo n.º 13
0
 public void PlayAnimation(string name)
 {
     //同じnameのステートを呼び出しても、AnimationClipの先頭のイベントは呼び出されない
     //先頭以降なら呼び出されそう
     //「アニメーションが始まったフレームで行いたい処理」はイベント以外でやった方がよさそう
     simpleAnimation.Stop();
     simpleAnimation.Play(name);
     stateChanged = true;
 }
Ejemplo n.º 14
0
 // Update is called once per frame
 void Update()
 {
     m_difference   = gameObject.transform.position.x - m_syoujo.transform.position.x;
     m_actionTimer += Time.deltaTime;
     if (m_difference < 2 && m_difference > -2)
     {
         if (m_actionTimer > 1)
         {
             SoundManager.Instance.PlaySE((int)Common.SEList.NearEnemyAttack);
             m_actionTimer = 0;
         }
         m_simple.Play("Attack");
     }
     else
     {
         m_simple.Play("Default");
     }
 }
	public void ChangeAnimation(AnimationClip cip, string stateName="Default") {
		if(animation.GetState(stateName) != null) {
			animation.Stop(stateName);
			animation.RemoveState(stateName);
		}
		animation.AddState(cip, stateName);
		animation.Play(stateName);
	}
Ejemplo n.º 16
0
    private void Start()
    {
        sa = GetComponent <SimpleAnimation>();
        if (sa == null)
        {
            sa = gameObject.AddComponent <SimpleAnimation>();
        }

        AnimationClip[] clips = Resources.LoadAll <AnimationClip>("animation_clip");
        name = new string[clips.Length];

        for (int i = 0; i < clips.Length; i++)
        {
            var c = clips[i];
            name[i] = c.name;
            sa.AddClip(c, name[i]);
        }

        sa.Play(name[cnt]);
    }
Ejemplo n.º 17
0
        public static IObservable <Unit> PlayAsObservable(this SimpleAnimation self, string stateName = DefaultStateName, bool forceRewind = false)
        {
            if (forceRewind)
            {
                self.Rewind(stateName);
            }
            var observable = self.OnStopAsObservable(stateName);

            self.Play(stateName);
            return(observable);
        }
Ejemplo n.º 18
0
 public void PlaySimpleAnime()
 {
     if (simpleAnime.GetState("fire") == null)
     {
         //animationClip.wrapMode = WrapMode.Once;
         animationClip.wrapMode = WrapMode.Clamp;                            // Same as Once
         //animationClip.wrapMode = WrapMode.ClampForever;
         simpleAnime.AddClip(animationClip, "fire");
     }
     simpleAnime.Play("fire");
     //simpleAnime.Play()
     //simpleAnime.CrossFade("fire_anime");
 }
Ejemplo n.º 19
0
    // ----------
    void Start()
    {
        blockLayer = LayerMask.GetMask(new string[] { "Block" });

        rbody           = GetComponent <Rigidbody2D>();
        simpleAnimation = GetComponent <SimpleAnimation>();
        // nameTextTrn = MyUtil.GetChild(this.transform, "NameText");

        playerManager = GetComponent <PlayerManager>();

        // 値の変更を監視: false → trueに戻った時に、通常のアニメーションに戻る
        canJump.SetOnChange(true, _ => simpleAnimation.Play("Default"));
    }
Ejemplo n.º 20
0
    void Start()
    {
        V = this;
        //var r = GetComponent<Rigidbody>();
        //r.constraints = RigidbodyConstraints.FreezeAll;

        foreach (var c in m_clips)
        {
            m_sanim.AddState(c, c.name);
        }
        transform.position = Vector3.zero;
        m_sanim.Play("WAIT00");
        //r.constraints = RigidbodyConstraints.None;
    }
Ejemplo n.º 21
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!bubbleCore.isHit)
        {
            if (collision.gameObject.tag == "Trap")
            {
                simpleAnimation.Play("Break");
                sePlayer.PlaySE("Break");
                bubbleCore.isHit = true;
            }

            if (collision.gameObject.tag == "Goal")
            {
                bubbleCore.isGoal = true;
            }
        }
    }
Ejemplo n.º 22
0
    private void Update()
    {
        if (isCharacterAnimatable == false)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            isCharacterAnimatable = false;
            characterObject.transform.DOMove(new Vector3(-12, -1.0f, 0), 0.45f).SetEase(Ease.InCubic);
            characterObject.Play("NICONICO");
            AnimeOtherUIEnd();
            retryUI.GetComponent <BlinkingCanvasGroup>().enabled = true;

            SEManager.Instance.Play(SEPath.KURAGEKOUBOU_BUTTON79);
            Invoke("DelayMethod", 0.2f);
        }
    }
Ejemplo n.º 23
0
    void CtrlPush()
    {
        if (isOnce && isPushed)
        {
            return;
        }
        var prevIsPushed = isPushed;

        isPushed = Collectable.Exists(
            transform.position,
            radius,
            includeCollected: true
            );
        if (prevIsPushed != isPushed)
        {
            var animation = isPushed ? "Pushed" : "Default";
            simpleAnimation.Play(animation);
        }
    }
Ejemplo n.º 24
0
    void FixedUpdate()
    {
        if (rbody == null)
        {
            return;
        }

        if (playerManager.isDead)
        {
            return;
        }

        // ジャンプ処理
        if (goJump)
        {
            simpleAnimation.Play("Jump");
            // SE音
            SoundManager.Play(SoundManager.SEClip.jump);

            // 上にジャンプさせる
            rbody.AddForce(Vector2.up * jumpPower);
            goJump = false;
        }

        // 左右移動
        rbody.velocity = new Vector2(
            move.x * acceleration * Time.fixedDeltaTime,
            rbody.velocity.y);

        // // 左右の向き変更
        // if (move.x > 0.1f)
        // {
        //     transform.localScale = rightDir;
        //     nameTextTrn.localScale = rightDir;
        // }
        // else if (move.x < -0.1f)
        // {
        //     transform.localScale = leftDir;
        //     nameTextTrn.localScale = leftDir;
        // }
    }
    /// <summary>
    /// 追跡
    /// </summary>
    void Chase()
    {
        //NavMeshが準備できているなら
        if (m_navmeshAgent.pathStatus != NavMeshPathStatus.PathInvalid)
        {
            //NavMeshAgentに目標地をセット
            m_navmeshAgent.SetDestination(m_target.transform.position);
            m_navmeshAgent.speed = m_runningSpeed;
        }

        if (m_catchAnimationTimer > 0)
        {
            m_catchAnimationTimer -= Time.deltaTime;
        }
        else
        {
            //捕まえるアニメーションの再生
            if (Vector3.Distance(transform.position, m_target.transform.position) < 5f)
            {
                Debug.Log("捕獲");
                m_simpleAnimation.Play("Attack");
                UnityAction action = OnCatchAnimationFinished;      //コールバック関数の登録
            }
        }

        if (Vector3.Distance(transform.position, m_target.transform.position) > m_distance)
        {
            //相手の位置と自分の位置の差ベクトルを求める
            Vector3 diff = m_target.transform.position - transform.position;

            float angle = Vector3.Angle(transform.forward, diff);
            if (angle > m_fieldOfView / 2f)
            {
                Debug.Log("巡回");
                m_moveState = MoveState.Patrol;  //巡回モードに切り替え
            }
        }
    }
Ejemplo n.º 26
0
 // Update is called once per frame
 void Update()
 {
     if (gameObject == m_this[0])
     {
         if (m_cage.PushCheck && !m_onCollisionStay)
         {
             m_pushed = true;
             m_simpleAnimation.Play("Reverse");
         }
     }
     if (gameObject == m_this[1])
     {
         if (m_cage.PushCheck2 && !m_onCollisionStay)
         {
             m_pushed = true;
             m_simpleAnimation.Play("Reverse");
         }
     }
 }
Ejemplo n.º 27
0
 public void DamageText()
 {
     textAnime.Stop();
     textAnime.Play();
 }
Ejemplo n.º 28
0
 // --- Stand ---
 void Stand_Enter()
 {
     _simpleAnimation.Play(StandStateName);
 }
Ejemplo n.º 29
0
 public void Hide()
 {
     mOldSoldierID = 0;
     mSimpleAnimation.Play(ClipCancelSelect);
 }
Ejemplo n.º 30
0
 private void Start()
 {
     simpleAnim.Play(Idle);
 }