コード例 #1
0
ファイル: InstagramMinigame.cs プロジェクト: Demy/caturday
    void Start()
    {
        result.Hide();

        pose           = Pose.poses[Random.Range(0, Pose.poses.Length)];
        status         = new PoseStatus(pose, character);
        struggleStatus = new PoseStatus(Pose.Struggle, character);
        CalculateEfficiency();

        SetWantedPose();
        SetKeyPose();
        SetStrugglePose();

        notStopped = true;

        if (CatCharacter.followers == 0)
        {
            ShowHint();
        }
        else
        {
            hint.Hide();
            StartTimer();
        }

        EventManager.StartListening(PoseStatus.POSE_DONE, OnPoseFinished);
        EventManager.StartListening(ShootingView.END_SHOT, OnEndShot);
        EventManager.StartListening(EXIT_GAME, LoadNextScene);
    }
コード例 #2
0
    private void Init()
    {
        controller = gameObject.GetComponent <EntityController>();
        if (controller == null)
        {
            controller = gameObject.AddComponent <EntityController>();
        }

        var charLoader = GetComponent <CharacterLoader>();

        if (charLoader == null)
        {
            charLoader = gameObject.AddComponent <CharacterLoader>();
        }

        charLoader.LoadCharactor(EntityId);
        if (posMng == null)
        {
            posMng = new PoseStatus();
        }
        try
        {
            posMng.Init(this);
        }
        catch
        {
            Debug.LogError("unit id:" + EntityId);
        }
        posMng.ChangeAction();
        if (controller != null)
        {
            controller.Init();
        }
    }
コード例 #3
0
ファイル: PoseKeySquenceView.cs プロジェクト: Demy/caturday
    public void SetPose(PoseStatus poseStatus)
    {
        _poseStatus = poseStatus;
        base.SetPose(poseStatus.pose);
        keyText      = transform.Find("Key").GetComponent <Text>();
        keyText.text = _poseStatus.GetCurrentKey();

        EventManager.StartListening(PoseStatus.KEY_CHANGED, ShowCurrentKey);
    }
コード例 #4
0
ファイル: EntityBehaviour.cs プロジェクト: Roy-H/Meteor
    public void ProcessBehaviour(Entity target)
    {
        PoseStatus posMng = target.posMng;

        Entity Owner = target;

        if (ProcessNormalAction(Owner))
        {
            return;
        }
    }
コード例 #5
0
 //在空闲,跑步,武器准备,带毒跑时,可以复活队友.
 bool CanChangeToRevive()
 {
     if (Player.posMng.mActiveAction.Idx == CommonAction.Idle || PoseStatus.IsReadyAction(Player.posMng.mActiveAction.Idx) || Player.posMng.mActiveAction.Idx == CommonAction.Run || Player.posMng.mActiveAction.Idx == CommonAction.RunOnDrug)
     {
         if (Player.HasRebornTarget())
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #6
0
    IEnumerator LoadData()
    {
        InfoPanel.gameObject.SetActive(true);
        int toProgress      = 0;
        int displayProgress = 0;

        yield return(Main.Ins.SFXLoader.Init());

        //在读取character.act后再初始化输入模块。
        Main.Ins.ActionInterrupt.Lines.Clear();
        Main.Ins.ActionInterrupt.Whole.Clear();
        Main.Ins.ActionInterrupt.Root = null;
        Main.Ins.ActionInterrupt.Init();
        Main.Ins.MenuResLoader.Init();

        //加载默认角色,这个角色有用的
        //AmbLoader.Ins.LoadCharacterAmb(0);

        for (int i = 0; i < 20; i++)
        {
            AmbLoader.Ins.LoadCharacterAmb(i);
            displayProgress++;
            percent.text = string.Format(StringUtils.Startup, displayProgress);
            LoadingBar.SetProgress((float)displayProgress / 100.0f);
            yield return(0);
        }

        AmbLoader.Ins.LoadCharacterAmb();
        AmbLoader.Ins.LoadCharacterAmbEx();
        toProgress = 100;

        while (displayProgress < toProgress)
        {
            displayProgress += 1;
            percent.text     = string.Format(StringUtils.Startup, displayProgress);
            LoadingBar.SetProgress((float)displayProgress / 100.0f);
            yield return(0);
        }
        PoseStatus.Clear();
        Application.targetFrameRate = Main.Ins.GameStateMgr.gameStatus.TargetFrame;
#if UNITY_EDITOR
        Application.targetFrameRate = 120;
#endif
        Log.Write(string.Format("fps:{0}", Application.targetFrameRate));
        if (!Main.Ins.GameStateMgr.gameStatus.SkipVideo)
        {
            string movie = string.Format(Main.strFile, Main.strHost, Main.port, Main.strProjectUrl, "mmv/start.mv");
            U3D.PlayMovie(movie);
        }
        Main.Ins.DlcMng.Init();
        Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.MainMenuState);
        Main.Ins.SplashScreenHidden = true;
    }
コード例 #7
0
    public void PlayAnimation()
    {
        int act = (ScrollView.CurrentData as AnimationCellData).animation;

        if (PoseStatus.ActionExist(Player.UnitId, act))
        {
            if (act == CommonAction.Jump)
            {
                Player.Jump(false, 1);
            }
            else
            {
                Player.posMng.ChangeAction(act, 0);
            }
        }
        else
        {
            Debug.LogError("角色不存在动作:" + act);
        }
    }
コード例 #8
0
    void ProcessGunAction(MeteorUnit target)
    {
        PoseStatus  posMng = target.posMng;
        MeteorInput Input  = target.controller.Input;
        MeteorUnit  Owner  = target;

        //响应
        if (Input.HasInput((int)EKeyList.KL_BreakOut, (int)EInputType.EIT_Click))
        {
            Owner.SetGunReady(false);
            Owner.DoBreakOut();
        }
        else  //除了跳/受击/爆气 清了枪蹲下的状态,其他全部不能清理这个状态
        if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
        {
            Owner.SetGunReady(false);
            Owner.SetGround(false);
            Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
        }
        else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
        {
            Owner.SetGunReady(false);
            Owner.SetGround(false);
            Jump(Owner, Input.mInputVector);
        }
        else
        if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
        {
            //这里要判断武器
            Owner.CrouchRush();
        }
        else
        if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
        {
            //这里要判断武器
            Owner.CrouchRush(1);
        }
        else
        if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
        {
            //这里要判断武器
            Owner.CrouchRush(2);
        }
        else
        if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
        {
            //这里要判断武器
            Owner.CrouchRush(3);
        }
        else if (Input.mInputVector != Vector2.zero)
        {
            MoveOnCrouch(Owner, Input.mInputVector);
        }
        else if (Input.mInputVector == Vector2.zero && !posMng.Rotateing)
        {
            if (posMng.mActiveAction.Idx != CommonAction.GunIdle)
            {
                posMng.ChangeAction(CommonAction.GunIdle);
            }
        }
    }
コード例 #9
0
    public void ProcessBehaviour(MeteorUnit target)
    {
        PoseStatus  posMng = target.posMng;
        MeteorInput Input  = target.controller.Input;
        MeteorUnit  Owner  = target;

        //后面改为状态机 遵循 当前动作-遍历每一个中断动作-扫描切换所需状态.符合则切换(关键是这个状态表不好生成)
        //除了idle以外还有其他预备动作,都可以随意切换
        if (posMng.mActiveAction.Idx == CommonAction.Idle ||
            PoseStatus.IsReadyAction(posMng.mActiveAction.Idx) ||
            posMng.mActiveAction.Idx == CommonAction.Dead)//动作是假死,角色没有挂
        {
            if (ProcessNormalAction(Owner))
            {
                return;
            }
            else if (Input.HasInput((int)EKeyList.KL_Help, (int)EInputType.EIT_Click))
            {
                //复活队友
                Owner.posMng.ChangeAction(CommonAction.Reborn);
            }
            else if (Input.HasInput((int)EKeyList.KL_Defence, (int)EInputType.EIT_Pressing))
            {
                Owner.Defence();
                return;
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Crouch, (int)EInputType.EIT_Pressing))
            {
                Owner.OnCrouch();
                return;
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(1);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(2);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(3);
            }
            else
            if (Input.mInputVector != Vector2.zero)
            {
                Move(Owner, Input.mInputVector);
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.Crouch || (posMng.mActiveAction.Idx >= CommonAction.CrouchForw && posMng.mActiveAction.Idx <= CommonAction.CrouchBack))
        {
            if (Owner.GetWeaponType() == (int)EquipWeaponType.Gun && Owner.GunReady)
            {
                ProcessGunAction(Owner);
                return;
            }

            //除了不能防御
            if (ProcessNormalAction(Owner))
            {
                return;
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Crouch, (int)EInputType.EIT_Releasing))
            {
                posMng.ChangeAction(CommonAction.Idle, 0.1f);
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.CrouchRush();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.CrouchRush(1);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.CrouchRush(2);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.CrouchRush(3);
            }
            else if (Input.mInputVector != Vector2.zero)
            {
                MoveOnCrouch(Owner, Input.mInputVector);
            }
            else if (Input.mInputVector == Vector2.zero && !posMng.Rotateing)
            {
                if (posMng.mActiveAction.Idx != CommonAction.Crouch)
                {
                    posMng.ChangeAction(CommonAction.Crouch, 0.1f);
                }
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.Run || posMng.mActiveAction.Idx == CommonAction.RunOnDrug)
        {
            if (Input.HasInput((int)EKeyList.KL_Help, (int)EInputType.EIT_Click))
            {
                //复活队友
                Owner.posMng.ChangeAction(CommonAction.Reborn);
            }
            else if (Input.HasInput((int)EKeyList.KL_Crouch, (int)EInputType.EIT_Pressing))
            {
                Owner.OnCrouch();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
            {
                Owner.IdleRush();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(1);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(2);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(3);
            }
            else
            if (Input.mInputVector == Vector2.zero)
            {
                posMng.ChangeAction(0, 0.1f);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector);
            }
            else
            if (ProcessNormalAction(Owner))
            {
                return;
            }
            else if (Input.mInputVector != Vector2.zero)
            {
                Move(Owner, Input.mInputVector);
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.WalkLeft)
        {
            if (Input.HasInput((int)EKeyList.KL_Crouch, (int)EInputType.EIT_Pressing))
            {
                Owner.OnCrouch();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
            {
                Owner.IdleRush();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(1);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(2);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(3);
            }
            else if (!posMng.Rotateing && Input.mInputVector == Vector2.zero)
            {
                posMng.ChangeAction(CommonAction.Idle, 0.1f);
            }
            else if (ProcessNormalAction(Owner))
            {
                return;
            }
            else if (Input.mInputVector != Vector2.zero)
            {
                Move(Owner, Input.mInputVector);
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.WalkRight)
        {
            if (Input.HasInput((int)EKeyList.KL_Crouch, (int)EInputType.EIT_Pressing))
            {
                Owner.OnCrouch();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
            {
                Owner.IdleRush();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(1);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(2);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(3);
            }
            else if (!posMng.Rotateing && Input.mInputVector == Vector2.zero)
            {
                posMng.ChangeAction(CommonAction.Idle, 0.1f);
            }
            else if (ProcessNormalAction(Owner))
            {
                return;
            }
            else if (Input.mInputVector != Vector2.zero)
            {
                Move(Owner, Input.mInputVector);
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.WalkBackward)
        {
            if (Input.HasInput((int)EKeyList.KL_Crouch, (int)EInputType.EIT_Pressing))
            {
                Owner.OnCrouch();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
                //Debug.LogError("jumpback");
            }
            else
            if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress) && Owner.IsOnGround())
            {
                Jump(Owner, Input.mInputVector);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_DoubleClick))
            {
                Owner.IdleRush();
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(1);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(2);
            }
            else
            if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_DoubleClick))
            {
                //这里要判断武器
                Owner.IdleRush(3);
            }
            else if (!posMng.Rotateing && Input.mInputVector == Vector2.zero)
            {
                posMng.ChangeAction(CommonAction.Idle, 0.1f);
            }
            else if (ProcessNormalAction(Owner))
            {
                return;
            }
            else if (Input.mInputVector != Vector2.zero)
            {
                Move(Owner, Input.mInputVector);
            }
        }
        else if ((posMng.mActiveAction.Idx >= CommonAction.BrahchthrustDefence &&
                  posMng.mActiveAction.Idx <= CommonAction.HammerDefence) ||
                 (posMng.mActiveAction.Idx >= CommonAction.ZhihuDefence &&
                  posMng.mActiveAction.Idx <= CommonAction.RendaoDefence))
        {
            //还有乾坤刀的其他2种姿势没处理
            if (Input.HasInput((int)EKeyList.KL_Defence, (int)EInputType.EIT_Releasing))
            {
                Owner.ReleaseDefence();
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.Struggle || posMng.mActiveAction.Idx == CommonAction.Struggle0)  //地面挣扎.僵直中无法输入.
        {
            if (Owner.IsOnGround())
            {
                if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_Release))
                {
                    posMng.ChangeAction(CommonAction.DCForw, 0.1f);
                }
                else if (Input.HasInput((int)EKeyList.KL_KeyS, (int)EInputType.EIT_Release))
                {
                    posMng.ChangeAction(CommonAction.DCBack, 0.1f);
                }
                else if (Input.HasInput((int)EKeyList.KL_KeyA, (int)EInputType.EIT_Release))
                {
                    posMng.ChangeAction(CommonAction.DCLeft, 0.1f);
                }
                else if (Input.HasInput((int)EKeyList.KL_KeyD, (int)EInputType.EIT_Release))
                {
                    posMng.ChangeAction(CommonAction.DCRight, 0.1f);
                }
                else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_ShortRelease))
                {
                    Jump(Owner, Input.mInputVector, Input.KeyStates[(int)EKeyList.KL_Jump].PressedTime / MeteorInput.ShortPressTime);
                }
                else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_FullPress))
                {
                    Jump(Owner, Input.mInputVector);
                }
                else if (Input.HasInput((int)EKeyList.KL_Defence, (int)EInputType.EIT_Click))
                {
                    if (posMng.mActiveAction.Idx == CommonAction.Struggle)
                    {
                        Owner.posMng.ChangeAction(CommonAction.IdleBack, 0.1f);
                    }
                    else if (posMng.mActiveAction.Idx == CommonAction.Struggle0)
                    {
                        Owner.posMng.ChangeAction(CommonAction.IdleFront, 0.1f);
                    }
                }
            }
        }
        else if (Owner.Climbing)
        {
            if (Input.HasInput((int)EKeyList.KL_KeyW, (int)EInputType.EIT_Release))
            {
                //Owner.ProcessFall();
                Owner.posMng.ChangeAction(CommonAction.JumpFall);
            }
            else if (Owner.ImpluseVec.y > 0 && Owner.OnTouchWall)
            {
                if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_Click))
                {
                    //Debug.LogError("ProcessTouchWallJump");
                    Owner.ProcessTouchWallJump(true);
                }
            }
            else if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_Click))
            {
                //Debug.LogError("ProcessJump2");
                Owner.ProcessJump2();
            }
        }
        else if (posMng.mActiveAction.Idx >= CommonAction.Jump && posMng.mActiveAction.Idx <= CommonAction.WallLeftJump)
        {
            if (Input.HasInput((int)EKeyList.KL_ChangeWeapon, (int)EInputType.EIT_Click))
            {
                Owner.ChangeWeapon();
            }
            else if (Owner.ImpluseVec.y > 0)
            {
                if (Input.HasInput((int)EKeyList.KL_Jump, (int)EInputType.EIT_Click))
                {
                    Owner.ProcessJump2();
                }
            }
        }
        else if (posMng.mActiveAction.Idx == CommonAction.GunIdle)
        {
            ProcessGunAction(Owner);
        }
        else if (posMng.IsHurtPose() &&
                 Input.HasInput((int)EKeyList.KL_BreakOut, (int)EInputType.EIT_Click))
        {
            Owner.DoBreakOut();
        }
    }
コード例 #10
0
    bool Check(out int targetPose)
    {
        if (mOwner != null)
        {
            //在硬直中
            if (mOwner.charLoader.IsInStraight())
            {
                //Debug.LogError("in straight:" + mOwner.charLoader.PoseStraight);
                targetPose = -1;
                return(false);
            }
            //技能中的动作,不许接输入
            if (mOwner.IsPlaySkill)
            {
                targetPose = -1;
                return(false);
            }
            if (Main.Ins.ActionInterrupt.Whole.ContainsKey(mOwner.posMng.mActiveAction.Idx) || mOwner.GetWeaponType() == (int)EquipWeaponType.Gun)
            {
                int targetIdx = mOwner.posMng.mActiveAction.Idx;

                //滚动或者闪动。可以连任意Pose与Idle一样
                if (targetIdx >= 164 && targetIdx <= 179)
                {
                    targetIdx = 0;
                }

                //任意准备动作,可以接任意Pose与Idle一样
                if (PoseStatus.IsReadyAction(targetIdx))
                {
                    targetIdx = 0;
                }

                //部分火枪动作,翻滚,攻击,都有后摇,不允许立即切换,必须等待动作完成
                if (mOwner.GunReady && !mOwner.posMng.IsAttackPose() &&
                    !(mOwner.posMng.mActiveAction.Idx >= CommonAction.DCForw && mOwner.posMng.mActiveAction.Idx <= CommonAction.DCBack))
                {
                    targetIdx = CommonAction.Idle;//模拟普通IDLE就可以发其他火枪招式了
                    //Debug.LogError("useGun");
                }

                if (!Main.Ins.ActionInterrupt.Whole.ContainsKey(targetIdx))
                {
                    //Debug.LogError(string.Format("not contains:{0}", targetIdx));
                    targetPose = -1;
                    return(false);
                }

                ActionNode no = Main.Ins.ActionInterrupt.Whole[targetIdx];
                //if (targetIdx == 200)
                //{
                //    Debug.LogError("200--");
                //}
                if (mOwner.IsOnGround())
                {
                    //拦截火枪的状态机,只要不处于213-使用火枪就进入212POSE
                    if (!mOwner.GunReady && mOwner.GetWeaponType() == (int)EquipWeaponType.Gun)
                    {
                        targetPose = CommonAction.GunReload;
                        //Debug.LogError("targetPose = 212");
                        return(true);
                    }

                    foreach (var each in lines)
                    {
                        for (int i = 0; i < no.target.Count; i++)
                        {
                            if (each.Value.Contains(no.target[i].ActionIdx))
                            {
                                bool ret = mOwner.controller.Input.CheckPos(each.Key, no.target[i].ActionIdx);
                                if (ret)
                                {
                                    targetPose = no.target[i].ActionIdx;
                                    //if (targetPose == 200 && targetIdx == 200)
                                    //{
                                    //    Debug.DebugBreak();
                                    //    Debug.LogError("link 200");
                                    //}
                                    return(ret);
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (var each in linesAir)
                    {
                        for (int i = 0; i < no.target.Count; i++)
                        {
                            if (each.Value.Contains(no.target[i].ActionIdx))
                            {
                                bool ret = mOwner.controller.Input.CheckPos(each.Key, no.target[i].ActionIdx);
                                if (ret)
                                {
                                    targetPose = no.target[i].ActionIdx;
                                    return(ret);
                                }
                            }
                        }
                    }
                }
            }
        }
        targetPose = -1;
        return(false);
    }
コード例 #11
0
    public void PlayFrame(float timeRatio)
    {
        TryPlayEffect();
        ChangeAttack();
        ChangeWeaponTrail();
        ActionEvent.HandlerActionEvent(owner, po.Idx, curIndex);
        if (PoseEvent.ContainsKey(po.Idx))
        {
            //当218发射飞轮,很快返回,还未到219动作时,下次播放219,就得立即取消循环,221 223
            PoseEvent.Remove(po.Idx);
            loop     = false;
            curIndex = po.LoopEnd;
        }
        if (TestInputLink())
        {
            return;
        }
        if (loop)
        {
            if (LockCurrentFrame)
            {
                if (PoseStraight <= 0.0f)
                {
                    loop             = false;
                    curIndex         = po.LoopEnd + 1;
                    LockCurrentFrame = false;
                    return;
                }
            }

            if (curIndex >= po.LoopEnd)
            {
                LoopCount++;
                PlayPosEvent();
                if (loop)
                {
                    curIndex = po.LoopStart;
                }
                return;
            }
        }
        else
        {
            if (curIndex > po.End)
            {
                posMng.OnActionFinished();
                return;
            }
            if (TheFirstFrame <= curIndex && TheFirstFrame != -1)
            {
                ActionEvent.HandlerFirstActionFrame(mOwner, po.Idx);
                TheFirstFrame = -1;
            }
            if (TheLastFrame <= curIndex && TheLastFrame != -1)
            {
                ActionEvent.HandlerFinalActionFrame(mOwner, po.Idx);
                TheLastFrame = -1;
            }
        }
        //Debug.Log("PlayKeyFrame:" + Time.frameCount);
        //curIndex = targetIndex;
        BoneStatus status     = null;
        BoneStatus lastStatus = null;

        if (lastSource == 0 && AmbLoader.CharCommon.Count > lastFrameIndex && lastFrameIndex >= 0)
        {
            lastStatus = AmbLoader.CharCommon[lastFrameIndex];
        }
        else if (AmbLoader.PlayerAnimation.ContainsKey(owner.UnitId) && AmbLoader.PlayerAnimation[owner.UnitId].Count > lastFrameIndex && lastFrameIndex >= 0)
        {
            lastStatus = AmbLoader.PlayerAnimation[owner.UnitId][lastFrameIndex];
        }
        if (po.SourceIdx == 0)
        {
            status = AmbLoader.CharCommon[curIndex];
        }
        else if (po.SourceIdx == 1)
        {
            status = AmbLoader.PlayerAnimation[owner.UnitId][curIndex];
        }
        else
        {
            status = AmbLoader.GetBoneStatus(po.SourceIdx, owner.UnitId, curIndex);
        }

        if (status != null && lastStatus != null)
        {
            bo[0].localRotation = Quaternion.Slerp(lastStatus.BoneQuat[0], status.BoneQuat[0], timeRatio);
            bo[0].localPosition = Vector3.Lerp(lastStatus.BonePos, status.BonePos, timeRatio);
            for (int i = 1; i < bo.Count; i++)
            {
                bo[i].localRotation = Quaternion.Slerp(lastStatus.BoneQuat[i], status.BoneQuat[i], timeRatio);
            }
        }

        bool IgnoreActionMoves = PoseStatus.IgnoreActionMove(po.Idx);

        if (owner.IsDebugUnit())
        {
            if (OnAnimationFrame != null)
            {
                OnAnimationFrame(po.SourceIdx, po.Idx, curIndex, timeRatio);
            }
            //IgnoreActionMoves = false;
        }

        bool IgnoreActionXZMove = PoseStatus.IgnoreXZMove(po.Idx);

        if (lastStatus != null && status != null)
        {
            if (lastPosIdx == po.Idx)
            {
                Vector3 targetPos = Vector3.Lerp(lastStatus.DummyPos[0], status.DummyPos[0], timeRatio);
                Vector3 vec       = Target.rotation * (targetPos - lastDBasePos) * moveScale;
                if (IgnoreActionMoves)
                {
                    vec.x = 0;
                    vec.z = 0;
                    vec.y = 0;
                }
                else if (IgnoreActionXZMove)
                {
                    vec.x = vec.z = 0;
                }
                moveDelta   += vec;
                lastDBasePos = targetPos;
            }

            for (int i = 1; i < dummy.Count; i++)
            {
                dummy[i].localRotation = Quaternion.Slerp(lastStatus.DummyQuat[i], status.DummyQuat[i], timeRatio);
                dummy[i].localPosition = Vector3.Lerp(lastStatus.DummyPos[i], status.DummyPos[i], timeRatio);
            }
        }
    }
コード例 #12
0
    void PlayNextKeyFrame()
    {
        TryPlayEffect();
        ChangeAttack();
        ChangeWeaponTrail();
        ActionEvent.HandlerActionEvent(owner, po.Idx, curIndex);
        if (PoseEvent.ContainsKey(po.Idx))
        {
            //当218发射飞轮,很快返回,还未到219动作时,下次播放219,就得立即取消循环,221 223
            PoseEvent.Remove(po.Idx);
            loop     = false;
            curIndex = po.LoopEnd;
        }

        //有连招.
        if (TestInputLink())
        {
            return;
        }

        if (loop)
        {
            if (LockCurrentFrame)
            {
                if (PoseStraight <= 0.0f)
                {
                    loop             = false;
                    curIndex         = po.LoopEnd + 1;
                    LockCurrentFrame = false;
                    return;
                }
            }
            if (curIndex > po.LoopEnd)
            {
                if (curIndex > po.LoopStart)
                {
                    LoopCount++;
                    PlayPosEvent();
                    if (loop)
                    {
                        curIndex = po.LoopStart;
                    }
                    return;
                }
                curIndex = po.LoopStart;
            }
        }
        else
        {
            if (curIndex > po.End)
            {
                posMng.OnActionFinished();
                return;
            }

            if (TheFirstFrame <= curIndex && TheFirstFrame != -1)
            {
                ActionEvent.HandlerFirstActionFrame(mOwner, po.Idx);
                TheFirstFrame = -1;
            }
            if (TheLastFrame <= curIndex && TheLastFrame != -1)
            {
                ActionEvent.HandlerFinalActionFrame(mOwner, po.Idx);
                TheLastFrame = -1;
            }
        }
        //Debug.Log("PlayKeyFrame:" + Time.frameCount);
        BoneStatus status = null;

        if (po.SourceIdx == 0)
        {
            status = AmbLoader.CharCommon[curIndex];
        }
        else if (po.SourceIdx == 1)
        {
            status = AmbLoader.PlayerAnimation[owner.UnitId][curIndex];
        }
        else
        {
            status = AmbLoader.GetBoneStatus(po.SourceIdx, owner.UnitId, curIndex);
        }

        //Debug.LogError("play keyframe " + " idx:" + curIndex);
        if (bo.Count != 0)
        {
            bo[0].localRotation = status.BoneQuat[0];
            bo[0].localPosition = status.BonePos;
        }

        for (int i = 1; i < bo.Count; i++)
        {
            bo[i].localRotation = status.BoneQuat[i];
        }

        bool IgnoreActionMoves = PoseStatus.IgnoreActionMove(po.Idx);
        //if (owner.IsDebugUnit())
        //    IgnoreActionMoves = false;
        bool IgnoreActionXZMove = PoseStatus.IgnoreXZMove(po.Idx);

        if (lastPosIdx == po.Idx)
        {
            Vector3 targetPos = status.DummyPos[0];
            Vector3 vec       = Target.rotation * (targetPos - lastDBasePos) * moveScale;
            //如果忽略位移,或者在动作的循环帧中,即第一次从循环头开始播放后,不再计算位移.
            if (IgnoreActionMoves)
            {
                vec.x = 0;
                vec.z = 0;
                vec.y = 0;
            }
            else if (IgnoreActionXZMove)
            {
                vec.x = vec.z = 0;
            }
            moveDelta += vec;
            //if (po.Idx == 151)
            //    Debug.LogError(string.Format("pose:{0} frame:{1} move: x ={2}, y ={3} z = {4}", po.Idx, curIndex, moveDelta.x, moveDelta.y, moveDelta.z));
            lastDBasePos = targetPos;
        }

        for (int i = 1; i < dummy.Count; i++)
        {
            dummy[i].localRotation = status.DummyQuat[i];
            dummy[i].localPosition = status.DummyPos[i];
        }

        lastFrameIndex = curIndex;
        curIndex++;
        lastSource = po.SourceIdx;
        lastPosIdx = po.Idx;
    }
コード例 #13
0
    public void ChangeAction(int idx = CommonAction.Idle, float time = 0.0f, int targetFrame = 0)
    {
        _Self.IgnoreGravitys(PoseStatus.IgnoreGravity(idx));//设置招式重力
        bool ignorePhy = IgnorePhysical(idx);

        if (ignorePhy != _Self.IgnorePhysical)
        {
            MeteorManager.Instance.PhysicalIgnore(_Self, ignorePhy);//设置招式是否忽略角色障碍
        }
        //看是否是大绝的起始招式/结束招式,大绝起始和结束招式之间的招式,不许响应输入切换招式.大绝不可取消.
        if (IsSkillStartPose(idx) && !_Self.IsPlaySkill)
        {
            _Self.IsPlaySkill = true;
        }
        else if ((IsSkillEndPose(idx) || onhurt) && _Self.IsPlaySkill)
        {
            _Self.IsPlaySkill = false;
        }

        //设置招式,是否冻结XZ轴速度,比如忍刀空中A,就冻结XZ轴速度,一下向下的招式都会如此,而水平招式不会
        _Self.ResetWorldVelocity(IgnoreVelocityXZ(idx));
        if (load != null)
        {
            int weapon = _Self.GetWeaponType();
            CanMove = false;
            if (idx == CommonAction.Defence)
            {
                switch ((EquipWeaponType)weapon)
                {
                case EquipWeaponType.Knife: idx = CommonAction.KnifeDefence; break;

                case EquipWeaponType.Sword: idx = CommonAction.SwordDefence; break;

                case EquipWeaponType.Blade: idx = CommonAction.BladeDefence; break;

                case EquipWeaponType.Lance: idx = CommonAction.LanceDefence; break;

                case EquipWeaponType.Brahchthrust: idx = CommonAction.BrahchthrustDefence; break;

                //case EquipWeaponType.Dart: idx = CommonAction.DartDefence;break;
                case EquipWeaponType.Gloves: idx = CommonAction.ZhihuDefence; break;    //没找到

                //case EquipWeaponType.Guillotines: idx = CommonAction.GuillotinesDefence;break;
                case EquipWeaponType.Hammer: idx = CommonAction.HammerDefence; break;

                case EquipWeaponType.NinjaSword: idx = CommonAction.RendaoDefence; break;

                case EquipWeaponType.HeavenLance: idx = CommonAction.QiankunDefenct; break;    //
                                                                                               //case EquipWeaponType.Gun: return;//
                }
            }
            else
            if (idx == CommonAction.Jump)
            {
                CanMove = true;//跳跃后,可以微量移动
            }
            else if ((idx >= CommonAction.WalkForward && idx <= CommonAction.RunOnDrug) || idx == CommonAction.Crouch)
            {
                CanMove = true;
            }
            else if (idx == CommonAction.Idle)
            {
                CanMove = true;
            }

            //蹲下左右旋转-蹲下前后左右移动,只要之前处于火枪预备则都可以瞬间出火枪的攻击
            if (weapon == (int)EquipWeaponType.Gun)
            {
                if ((idx >= CommonAction.CrouchForw && idx <= CommonAction.CrouchBack) || idx == CommonAction.GunIdle)
                {
                    if (idx == CommonAction.GunIdle && !_Self.GunReady)
                    {
                        _Self.SetGunReady(true);
                    }
                    if (_Self.Attr.IsPlayer)
                    {
                        if (_Self.GunReady)
                        {
                            if (!GunShootUI.Exist)
                            {
                                GunShootUI.Instance.Open();
                            }
                        }
                        else
                        {
                            if (GunShootUI.Exist)
                            {
                                GunShootUI.Instance.Close();
                            }
                        }
                    }
                }
                else
                {
                    if (_Self.Attr.IsPlayer)
                    {
                        if (GunShootUI.Exist)
                        {
                            GunShootUI.Instance.Close();
                        }
                    }
                }
            }
            else if (_Self.Attr.IsPlayer)
            {
                if (GunShootUI.Exist)
                {
                    GunShootUI.Instance.Close();
                }
            }

            //除了受击,防御,其他动作在有锁定目标下,都要转向锁定目标.
            if (_Self.GetLockedTarget() != null && !onDefence && !onhurt)
            {
                //NPC只在处于杀死敌方的状态时会朝角色转向
                if (_Self.robot != null && _Self.robot.Status == EAIStatus.Kill)
                {
                    if (_Self.GetWeaponType() != (int)EquipWeaponType.Guillotines &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Gun &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Dart)
                    {
                        _Self.FaceToTarget(_Self.GetLockedTarget());
                    }
                }
                else if (_Self.robot == null)
                {
                    _Self.FaceToTarget(_Self.GetLockedTarget());
                }
            }
            load.SetPosData(ActionList[UnitId][idx], time, false, targetFrame);
            mActiveAction = ActionList[UnitId][idx];
            LinkInput.Clear();
        }
    }
コード例 #14
0
    public void ChangeAction(int idx = CommonAction.Idle, float time = 0.01f)
    {
        //if (idx == 151 || idx == 152)
        //{
        //    string stackInfo = new StackTrace().ToString();
        //    UnityEngine.Debug.Log(stackInfo);
        //}
        CanAdjust = false;
        if (_Self.GameFinished && !playResultAction && (idx == CommonAction.Idle || idx == CommonAction.GunIdle))
        {
            playResultAction = true;
            if (_Self.Camp == EUnitCamp.EUC_ENEMY && Main.Ins.GameBattleEx.BattleLose())
            {
                ChangeAction(CommonAction.Taunt, 0.1f);
                return;
            }
            else if (_Self.Camp == EUnitCamp.EUC_FRIEND && Main.Ins.GameBattleEx.BattleWin())
            {
                ChangeAction(CommonAction.Taunt, 0.1f);
                return;
            }
        }

        _Self.IgnoreGravitys(PoseStatus.IgnoreGravity(idx));//设置招式重力
        bool ignorePhy = IgnorePhysical(idx);

        if (ignorePhy != _Self.IgnorePhysical)
        {
            Main.Ins.MeteorManager.PhysicalIgnore(_Self, ignorePhy);//设置招式是否忽略角色障碍
        }
        //看是否是大绝的起始招式/结束招式,大绝起始和结束招式之间的招式,不许响应输入切换招式.大绝不可取消.
        if (IsSkillStartPose(idx) && !_Self.IsPlaySkill)
        {
            _Self.IsPlaySkill = true;
        }
        else if ((IsSkillEndPose(idx) || onhurt) && _Self.IsPlaySkill)
        {
            _Self.IsPlaySkill = false;
        }

        //设置招式是否冻结世界轴XZ上得速度.
        _Self.ResetWorldVelocity(IgnoreVelocityXZ(idx));
        if (load != null)
        {
            int weapon = _Self.GetWeaponType();
            CanMove = false;
            if (idx == CommonAction.Defence)
            {
                switch ((EquipWeaponType)weapon)
                {
                case EquipWeaponType.Knife: idx = CommonAction.KnifeDefence; break;

                case EquipWeaponType.Sword: idx = CommonAction.SwordDefence; break;

                case EquipWeaponType.Blade: idx = CommonAction.BladeDefence; break;

                case EquipWeaponType.Lance: idx = CommonAction.LanceDefence; break;

                case EquipWeaponType.Brahchthrust: idx = CommonAction.BrahchthrustDefence; break;

                //case EquipWeaponType.Dart: idx = CommonAction.DartDefence;break;
                case EquipWeaponType.Gloves: idx = CommonAction.ZhihuDefence; break;    //没找到

                //case EquipWeaponType.Guillotines: idx = CommonAction.GuillotinesDefence;break;
                case EquipWeaponType.Hammer: idx = CommonAction.HammerDefence; break;

                case EquipWeaponType.NinjaSword: idx = CommonAction.RendaoDefence; break;

                case EquipWeaponType.HeavenLance: idx = CommonAction.QiankunDefenct; break;    //
                                                                                               //case EquipWeaponType.Gun: return;//
                }
            }
            else
            if (idx == CommonAction.Jump)
            {
                CanAdjust = true;//跳跃后,可以微量移动
                CanMove   = true;
            }
            else if ((idx >= CommonAction.WalkForward && idx <= CommonAction.RunOnDrug) || idx == CommonAction.Crouch)
            {
                CanMove = true;
            }
            else if (idx == CommonAction.Idle)
            {
                CanMove = true;
            }

            //蹲下左右旋转-蹲下前后左右移动,只要之前处于火枪预备则都可以瞬间出火枪的攻击
            if (weapon == (int)EquipWeaponType.Gun)
            {
                if ((idx >= CommonAction.CrouchForw && idx <= CommonAction.CrouchBack) || idx == CommonAction.GunIdle)
                {
                    if (idx == CommonAction.GunIdle && !_Self.GunReady)
                    {
                        _Self.SetGunReady(true);
                    }
                    if (_Self.Attr.IsPlayer)
                    {
                        if (_Self.GunReady)
                        {
                            Main.Ins.EnterState(Main.Ins.GunShootDialogStatus);
                        }
                        else
                        {
                            Main.Ins.ExitState(Main.Ins.GunShootDialogStatus);
                        }
                    }
                }
                else
                {
                    if (_Self.Attr.IsPlayer)
                    {
                        Main.Ins.ExitState(Main.Ins.GunShootDialogStatus);
                    }
                }
            }
            else if (_Self.Attr.IsPlayer)
            {
                Main.Ins.ExitState(Main.Ins.GunShootDialogStatus);
            }

            //除了受击,防御,其他动作在有锁定目标下,都要转向锁定目标.
            if (_Self.LockTarget != null && !onDefence && !onhurt)
            {
                //是否旋转面向目标.
                if (_Self.StateMachine != null && _Self.StateMachine.IsFighting())
                {
                    //NPC.
                    //远程武器无需转向.
                    if (_Self.GetWeaponType() != (int)EquipWeaponType.Guillotines &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Gun &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Dart)
                    {
                        _Self.FaceToTarget(_Self.LockTarget);
                    }
                }
                else if (_Self.StateMachine == null && Main.Ins.GameStateMgr.gameStatus.AutoLock && idx != CommonAction.Idle)
                {
                    //主角.
                    if (_Self.GetWeaponType() != (int)EquipWeaponType.Guillotines &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Gun &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Dart)
                    {
                        _Self.FaceToTarget(_Self.LockTarget);
                    }
                }
            }
            load.SetPosData(ActionList[UnitId][idx], time);
            mActiveAction    = ActionList[UnitId][idx];
            mActiveActionIdx = mActiveAction.Idx;
            LinkInput.Clear();
        }
    }
コード例 #15
0
    public void Init(int modelIdx, int layer, bool updateModel = false)
    {
        tag           = "meteorUnit";
        UnitId        = modelIdx;
        IgnoreGravity = true;

        if (updateModel)
        {
            //把伤害盒子去掉,把受击盒子去掉
            hitList.Clear();

            if (charLoader != null)
            {
                GameObject.Destroy(charLoader.rootBone.parent.gameObject);
                GameObject.Destroy(charLoader.Skin.gameObject);
                charLoader = null;
            }
        }

        if (Attr == null && Main.Ins.MeteorManager != null && Main.Ins.LocalPlayer != null)
        {
            Attr = Main.Ins.LocalPlayer.Attr;
        }
        if (charLoader == null)
        {
            charLoader = new CharacterLoader();
        }
        if (posMng == null)
        {
            posMng = new PoseStatus();
        }
        if (updateModel)
        {
            transform.position = Vector3.zero;
            transform.rotation = Quaternion.identity;
        }
        charLoader.LoadCharactor(UnitId, transform);
        posMng.Init(this);
        WeaponR      = NodeHelper.Find("d_wpnR", charLoader.rootBone.gameObject).transform;
        WeaponL      = NodeHelper.Find("d_wpnL", charLoader.rootBone.gameObject).transform;
        ROOTNull     = NodeHelper.Find("b", gameObject).transform;
        RootdBase    = charLoader.rootBone;
        CameraTarget = RootdBase;
        weaponLoader = gameObject.GetComponent <WeaponLoader>();
        if (updateModel)
        {
            Destroy(weaponLoader);
            weaponLoader = null;
        }
        if (weaponLoader == null)
        {
            weaponLoader = gameObject.AddComponent <WeaponLoader>();
        }
        weaponLoader.Init(this);
        charController = gameObject.GetComponent <CharacterController>();
        if (charController == null)
        {
            charController = gameObject.AddComponent <CharacterController>();
        }
        charController.center     = new Vector3(0, 16, 0);
        charController.height     = 32;
        charController.radius     = 9.0f;//不这么大碰不到寻路点.
        charController.stepOffset = 7.6f;
        posMng.ChangeAction();
        WsGlobal.SetObjectLayer(gameObject, layer);
        InventoryItem itWeapon = Main.Ins.GameStateMgr.MakeEquip(1);

        weaponLoader.EquipWeapon(itWeapon);
        this.name = Main.Ins.CombatData.GetCharacterName(UnitId);
    }