Esempio n. 1
0
    public void TurnAnimation(VHeroAttackState state)
    {
        switch (state)
        {
        case VHeroAttackState.Idle:
            this._Animation.state.SetAnimation(0, "walk", true);
            break;

        case VHeroAttackState.Attack:
            this._Animation.state.SetAnimation(0, "attack", true);
            break;
        }
    }
Esempio n. 2
0
    public virtual void Init(VAnimalInfo info, Vector3 pos, int weaponId)
    {
        _Info = info;

        GameObject spr = GameObject.Instantiate(Resources.Load(info.Path + "/" + info.Id.ToString())) as GameObject;

        spr.name = info.Id.ToString();
        spr.transform.position = pos;

        _Handle = spr.transform;
        _CC     = this._Handle.gameObject.GetComponent <CharacterController>();
        if (_CC == null)
        {
            _CC = this._Handle.gameObject.AddComponent <CharacterController>();
        }
        _JumpSpeed = Main.Instance.JumpSpeed;

        _Animation = this._Handle.gameObject.GetComponent <SkeletonAnimation>();
        if (_Animation == null)
        {
            Debug.LogError(info.Id + " 没有骨骼动画 ");
        }

        _State = VHeroAttackState.Idle;

        _HP = 11;

        //TODO: 此处确定 人物初始朝向
        int face = 1;

        if (face.Equals(FaceType.Left))
        {
            this.FaceType = FaceType.Left;
        }
        else if (face.Equals(FaceType.Right))
        {
            this.FaceType = FaceType.Right;
        }

        _Attribute = new VAttribute();
        _Attribute.Init(info);

        _Weapon = new VWeapon();
        _Weapon.Init(this, weaponId);
    }