/// <summary>
 /// 新建函数
 /// </summary>
 /// <param name="c"></param>
 public void Copy(CharaPrefab c)
 {
     m_CharaState = new CharaState(c.m_CharaState);
     m_charaBackGroundInformation = new CharaBackGroundInformation(c.m_charaBackGroundInformation);
     m_CharaAttackData            = new CharaAttackData(c.m_CharaAttackData);
     m_CharaState.CurrentEmotion  = m_CharaState.MaxEmotion;
 }
Ejemplo n.º 2
0
 void Start()
 {
     state = CharaState.Idle;
     humanAnimation.Play("Default"); // 敢えて書いておく
     eggMan.OnJumpTop += JumpTop;
     eggMan.OnJumpEnd += JumpEnd;
 }
Ejemplo n.º 3
0
 void JumpEnd()
 {
     state = CharaState.Idle;
     humanAnimation.Play("Default");
     moveSpeed = 0.0F;
     move      = false;
 }
Ejemplo n.º 4
0
    //转换角色状态
    public void ChangeCharaState(CharaState _state)
    {
        characterstate = _state;

#if _Debug
        Debug.Log("change characterstate:" + _state.ToString());
#endif
    }
    public CharaState(CharaState cs)
    {
        maxHealth     = cs.maxHealth;
        currentHealth = cs.currentHealth;

        MaxEmotion     = cs.maxHealth;
        CurrentEmotion = cs.CurrentEmotion;
    }
Ejemplo n.º 6
0
 void Idle()
 {
     if (state == CharaState.Jump || state == CharaState.Spinig)
     {
         return;
     }
     state = CharaState.Idle;
     humanAnimation.Play("Default");
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     manager  = GameObject.Find("GameManager");
     dir      = Direction.Right;
     state    = CharaState.Fall;
     detector = new bool[6];
     isWalk   = false;
     isClimb  = false;
 }
Ejemplo n.º 8
0
    void JumpTop()
    {
        state = CharaState.Fall;
        // move
        var currentPos = humanTransform.position;

        moveTo    = new Vector3(currentPos.x, 0.0F, currentPos.z);
        moveSpeed = jumpSpeed;
        move      = true;
    }
Ejemplo n.º 9
0
 public ObjState(CharaState chara)
 {
     name      = chara.name;
     MaxHp     = chara.MaxHp;
     Hp        = MaxHp;
     Atk       = chara.Atk;
     Def       = chara.Def;
     Agi       = chara.Agi;
     NextLebel = chara.NextLebel;
 }
Ejemplo n.º 10
0
 void Squat()
 {
     if (state == CharaState.Jump || state == CharaState.Fall)
     {
         return;
     }
     state = CharaState.Squat;
     humanAnimation.Play("Squat");
     moveSpeed = 0.0F;
     move      = false;
 }
Ejemplo n.º 11
0
 void Idle()
 {
     if (state == CharaState.Jump || state == CharaState.Fall || state == CharaState.Squat)
     {
         return;
     }
     state = CharaState.Idle;
     humanAnimation.Play("Default");
     moveSpeed = 0.0F;
     move      = false;
 }
Ejemplo n.º 12
0
    void Jump()
    {
        if (state == CharaState.Jump || state == CharaState.Fall)
        {
            return;
        }
        state = CharaState.Jump;
        humanAnimation.Play("Jump");
        // move
        var currentPos = humanTransform.position;

        moveTo    = new Vector3(currentPos.x, 1.0F, currentPos.z);
        moveSpeed = jumpSpeed;
        move      = true;
    }
Ejemplo n.º 13
0
 //******************************************************
 /// <summary>
 /// スプライト、「Turn」か「Ok」か切り替える
 /// </summary>
 /// <param name="state">フレームの状態を受け取る</param>
 //******************************************************
 private void setActiveState(CharaState state)
 {
     //スタンバイ状態のとき
     if (state == CharaState.Standby)
     {
         ok.SetActive(true);
         turn.SetActive(false);
     }
     //ノーマルとウェイト状態のとき
     else
     {
         ok.SetActive(false);
         turn.SetActive(true);
     }
 }
Ejemplo n.º 14
0
        public override void HitChara(Character character)
        {
            if (character is Attack)
            {
                if (CheckDirection(character) == Direction.Right)
                {
                    direction = Direction.Right;
                }
                if (CheckDirection(character) == Direction.Left)
                {
                    direction = Direction.Left;
                }

                state = CharaState.Damage;
                //isDeadFlag = true;
            }
        }
Ejemplo n.º 15
0
        public Enemy(string name, Vector2 position, AIName aiName, GameDevice gameDevice, IGameObjectMediator mediator)
            : base(name, position, 64, 64, 55, 60, gameDevice)
        {
            this.Position = position;
            this.aiName   = aiName;
            this.mediator = mediator;
            map           = mediator.GetMap();

            damageTimer     = new CountDownTimer(0.5f);
            gravity         = 0.5f;
            damageVelocityY = -5;

            state = CharaState.Normal;

            SetAI();

            //【追加】モーションの生成・追加
            motionDict = new Dictionary <MotionName, Util.Motion>()
            {
                { MotionName.attack, new Motion(new Range(0, 4), new CountDownTimer(0.25f)) },
                { MotionName.move, new Motion(new Range(0, 4), new CountDownTimer(0.15f)) },
                { MotionName.idling, new Motion(new Range(0, 4), new CountDownTimer(0.25f)) },
            };

            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.attack].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.move].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.idling].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            //最初のモーションはムーブに設定
            currentMotion = motionDict[MotionName.move];

            //【追加】移動方向の設定
            myDirectionX = Direction.Right;
            myDirectionY = Direction.Top;
        }
Ejemplo n.º 16
0
    private void AI()
    {
        if (!detector[0])
        {
            //落下途中止まらないためにx座標修正
            float x = (int)(transform.position.x / 0.64f);
            x += (transform.position.x > 0) ? 0.5f : -0.5f;
            transform.position = new Vector3(x * 0.64f, transform.position.y, transform.position.z);

            state   = CharaState.Fall;
            isWalk  = false;
            isClimb = false;
            return;
        }

        if (detector[3] && detector[5])
        {
            ReverseDir();
        }

        if (detector[3] && !detector[5])
        {
            Jump(0.7f, 4.3f);
            state   = CharaState.JumpUp;
            isWalk  = true;
            isClimb = false;
            return;
        }

        if (!detector[3] && !detector[5] && !detector[1] && detector[2])
        {
            Jump(2.1f * speed, 2.5f);
            state   = CharaState.JumpForward;
            isWalk  = true;
            isClimb = false;
            return;
        }

        state   = CharaState.MoveForward;
        isWalk  = true;
        isClimb = false;
    }
Ejemplo n.º 17
0
    void RunRight()
    {
        if (state == CharaState.Jump || state == CharaState.Spinig)
        {
            return;
        }
        // 左を向いているので右を向く
        if (filipedLelt)
        {
            FlipHuman();
        }
        state = CharaState.RunRight;
        humanAnimation.Play("Run");
        // move
        var currentPos = humanTransform.position;
        var moveTo     = new Vector3(
            (currentPos.x + runUnit >= edgeX) ? edgeX : currentPos.x + runUnit,  // 端を超えないように
            currentPos.y,
            currentPos.z);

        humanTransform.position = Vector3.MoveTowards(currentPos, moveTo, Time.deltaTime * runSpeed);
    }
Ejemplo n.º 18
0
        private void DamageUpdate(GameTime gameTime)
        {
            damageTimer.Update(gameTime);

            if (direction == Direction.Right)
            {
                Position += new Vector2(10, damageVelocityY);
            }
            else if (direction == Direction.Left)
            {
                Position += new Vector2(-10, damageVelocityY);
            }

            damageVelocityY += gravity;

            if (damageTimer.IsTime())
            {
                damageTimer.Initialize();
                state           = CharaState.Delete;
                damageVelocityY = -5;
            }
        }
Ejemplo n.º 19
0
    public ChangeSprite frameSprite;    ///<オブジェクト保存用の変数


    //**********************************************************
    /// <summary>
    /// キャラクターのフレームを設定する
    /// </summary>
    /// <param name="state">キャラクターの状態を受け取る</param>
    //**********************************************************
    public void SetFrameState(CharaState state)
    {
        switch (state)
        {
        //ノーマル状態の場合
        case CharaState.Normal:
            setActiveState(state);
            break;

        //スタンバイ状態の場合
        case CharaState.Standby:
            setActiveState(state);
            break;

        //ウェイト状態の場合
        case CharaState.Wait:
            setActiveState(state);
            break;
        }

        frameSprite.SetSprite((int)state);
    }
Ejemplo n.º 20
0
    void RunLeft()
    {
        if (state == CharaState.Jump || state == CharaState.Fall)
        {
            return;
        }
        // 右を向いているので左を向く
        if (!filipedLelt)
        {
            FlipHuman();
        }
        state = CharaState.RunLeft;
        humanAnimation.Play("Run");
        // move
        var currentPos = humanTransform.position;

        moveTo = new Vector3(
            (currentPos.x - runUnit <= -edgeX) ? -edgeX : currentPos.x - runUnit, // 端を超えないように
            currentPos.y,
            currentPos.z);
        moveSpeed = runSpeed;
        move      = true;
    }
Ejemplo n.º 21
0
// ---------------------
    public void PerformUseAction()
    {
        this.charaState = CharaState.USE;

        this.charaAnim.CrossFade(this.ANIM_IDLE, 0.3f);                        // idle on base layer
        this.charaAnim.CrossFade(this.ANIM_USE, 0.3f, PlayMode.StopSameLayer); // use on it's own layer
        this.useElapsed = 0;

        //Debug.Log("[" + Time.frameCount + "] USE!");


        // Play sound effect...

        AudioSource audioSource = this.GetComponent <AudioSource>();

        if ((this.actionSound != null) && (audioSource != null))
        {
            audioSource.PlayOneShot(this.actionSound);
        }


        // look for useable items in range!
    }
Ejemplo n.º 22
0
 public void Climb()
 {
     isClimb = true;
     state   = CharaState.MoveUp;
 }
Ejemplo n.º 23
0
 // --------------------
 public void StartWalking()
 {
     this.charaState = CharaState.WALK;
     this.charaAnim.CrossFade(this.ANIM_WALK_F, 0.3f);
 }
Ejemplo n.º 24
0
 // -------------------
 public void StartRunning()
 {
     this.charaState = CharaState.RUN;
     this.charaAnim.CrossFade(this.ANIM_RUN_F, 0.3f);
 }
Ejemplo n.º 25
0
 // --------------------
 public void StartIdle()
 {
     this.charaState = CharaState.IDLE;
     this.charaAnim.CrossFade(this.ANIM_IDLE, 0.3f);
 }
Ejemplo n.º 26
0
    // ---------------------
    public void PerformUseAction()
    {
        this.charaState = CharaState.USE;

        this.charaAnim.CrossFade(this.ANIM_IDLE, 0.3f);		// idle on base layer
        this.charaAnim.CrossFade(this.ANIM_USE, 0.3f, PlayMode.StopSameLayer);		// use on it's own layer
        this.useElapsed = 0;

        //Debug.Log("[" + Time.frameCount + "] USE!");

        // Play sound effect...

        if ((this.actionSound != null) && (this.audio != null))
        this.audio.PlayOneShot(this.actionSound);

        // look for useable items in range!
    }
Ejemplo n.º 27
0
// --------------------
    public void StartIdle()
    {
        this.charaState = CharaState.IDLE;
        this.charaAnim.CrossFade(this.ANIM_IDLE, 0.3f);
    }
Ejemplo n.º 28
0
// --------------------
    public void StartWalking()
    {
        this.charaState = CharaState.WALK;
        this.charaAnim.CrossFade(this.ANIM_WALK_F, 0.3f);
    }
Ejemplo n.º 29
0
// -------------------
    public void StartRunning()
    {
        this.charaState = CharaState.RUN;
        this.charaAnim.CrossFade(this.ANIM_RUN_F, 0.3f);
    }
Ejemplo n.º 30
0
 public void ChangeState(CharaState next)
 {
     _State = next;
 }
Ejemplo n.º 31
0
 void Jump()
 {
     state = CharaState.Jump;
     humanAnimation.Play("Jump");
 }
 public void Copy(EnemyType enemy)
 {
     m_CharaState = new CharaState(enemy.m_CharaState);
     m_charaBackGroundInformation = new CharaBackGroundInformation(enemy.m_charaBackGroundInformation);
     m_CharaAttackData            = new CharaAttackData(enemy.m_CharaAttackData);
 }
Ejemplo n.º 33
0
 void JumpEnd()
 {
     state = CharaState.Idle;
     humanAnimation.Play("Default");
 }
Ejemplo n.º 34
0
 public void SetState(CharaState state)
 {
     this.state = state;
 }