コード例 #1
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);
    }
コード例 #2
0
ファイル: CWeapon.cs プロジェクト: lawerencem/Everpixel
 public void SetView(VWeapon v)
 {
     this._view = v;
 }