Example #1
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="po0"></param>
    /// <param name="po1"></param>
    public override void InitPO(CharacterPO po0, CharacterRefreshPO po1)
    {
        _animator   = transform.Find("Root").GetComponent <Animator>();
        _rigidbody  = GetComponent <Rigidbody>();
        LookAtPoint = FindParentObject("LookAtPoint").transform;

        PterosaurStep1  step1  = new PterosaurStep1(this);
        PterosaurStep2  step2  = new PterosaurStep2(this);
        PterosaurStep3  step3  = new PterosaurStep3(this);
        PterosaurStep4  step4  = new PterosaurStep4(this);
        PterosaurStep5  step5  = new PterosaurStep5(this);
        PterosaurStep6  step6  = new PterosaurStep6(this);
        PterosaurStep7  step7  = new PterosaurStep7(this);
        PterosaurStep8  step8  = new PterosaurStep8(this);
        PterosaurStep9  step9  = new PterosaurStep9(this);
        PterosaurStep10 step10 = new PterosaurStep10(this);

        SetBodyActive();

        _baseHealth         = po0.Health;
        _worth              = po0.Score;
        _baseSpeed          = po0.BaseSpeed;
        _rotationSpeed      = po0.RotationSpeed;
        _agentID            = po0.Id;
        _agentType          = (E_AgentType)po0.Type;
        _destroyEffectSound = po0.DestroyEffectSound;
        _explodeEffectSound = po0.ExplodeEffectSound;
        _destroySound       = po0.DestroySound;
        _attackDamage       = po0.DamageValue;
        _invincible         = false;
        _health             = _baseHealth;
        mMoveSpeed          = _baseSpeed;

        //#region Init Hit Point
        //int index = 0;
        //for (int i = 0; i < po0.HitBone.Length; ++i)
        //{
        //    string boneName = po0.HitBone[i];
        //    if (boneName.Equals("XXX"))
        //        ++index;
        //    GameObject go = FindParentObject(boneName);
        //    if (go != null)
        //    {
        //        HitPoint hitpoint = go.GetOrAddComponent<HitPoint>();
        //        switch (index)
        //        {
        //            case 0:
        //                hitpoint.SetParentType(HitPoint.E_Parent.Claw);
        //                break;
        //            case 1:
        //                hitpoint.SetParentType(HitPoint.E_Parent.Beat);
        //                break;
        //        }
        //    }
        //}
        //#endregion

        EventDispatcher.AddEventListener(EventDefine.Boss_Change_State, NextStep);
        EventDispatcher.AddEventListener <int, float>(EventDefine.Boss_Hit_Point_Break, AddDamageValue);
    }
Example #2
0
        public ActionResult CreateCharacter(CharacterPO form)
        {
            ActionResult response = null;

            if ((Int64)Session["RoleID"] >= 2)
            {
                CharacterMap map = new CharacterMap();
                if (ModelState.IsValid)
                {
                    CharacterDO characterObject = map.CharacterPOToDO(form);

                    dl.CreateCharacter(characterObject);
                    response = RedirectToAction("CharacterIndex", new { gameID = form.GameID });
                }
                else
                {
                    ViewBag.gameID = form.GameID;
                    response       = View(form);
                }
            }
            else
            {
                response = RedirectToAction("CharacterIndex", new { gameID = form.GameID });
            }
            return(response);
        }
Example #3
0
    public override void InitPO(CharacterPO po0, CharacterRefreshPO po1)
    {
        _agentID            = po0.Id;
        _health             = po0.Health;
        _worth              = po0.Score;
        _baseSpeed          = po0.BaseSpeed;
        _rotationSpeed      = po0.RotationSpeed;
        _agentType          = (E_AgentType)po0.Type;
        _destroyEffectSound = po0.DestroyEffectSound;
        _explodeEffectSound = po0.ExplodeEffectSound;
        _destroySound       = po0.DestroySound;
        _attackDamage       = po0.DamageValue;
        _worth              = po0.Score;

        targetAgentID = po1.TargetAgentID;
        ActionType    = (global::E_ActionType)po1.ActionType;
        //mMoveSpeed = _baseSpeed * Random.Range(po1.FactorSpeed[0], po1.FactorSpeed[1]);
        _disappearTime = po1.DisappearTime;
        _disappearType = _disappearTime == 0 ? E_DisappearType.Normal : E_DisappearType.CanDisappear;

        _rigidbody = GetComponent <Rigidbody>();

        SetBodyActive();

        ConstructFSM();
    }
Example #4
0
 public CharacterBaseAttr(CharacterPO agentPO)
 {
     mID                       = agentPO.Id;
     mPrefabName               = agentPO.Name;
     mCharacterType            = (E_CharacterType)agentPO.Type;
     mBaseSpeed                = agentPO.BaseSpeed;
     mBaseRotationSpeed        = agentPO.RotationSpeed;
     mMaxHP                    = agentPO.Health;
     mWorth                    = agentPO.Score;
     mDamageValue              = agentPO.DamageValue;
     mBornEffectName           = agentPO.BornEffect;
     mBeAttackedEffectName     = agentPO.HitEffect;
     mDeadEffectName           = agentPO.DieEffet;
     mExplodeEffectSoundName   = agentPO.ExplodeEffectSound;
     mBeDestroyEffectSoundName = agentPO.DestroyEffectSound;
     mBeDestroySoundName       = agentPO.DestroySound;
     mDisappearTime            = agentPO.DisappearTime;
     mValidTime                = agentPO.ValidTime;
     mFogTime                  = agentPO.FogTime;
     mFreezeTime               = agentPO.FreezeTime;
     mOffset_Y                 = agentPO.Offset_Y;
     mHeadID                   = agentPO.HeadID;
     mMapID                    = agentPO.MapID;
     mHitBone                  = agentPO.HitBone;
 }
Example #5
0
 private void InitCharacterBaseAttr()
 {
     mCharacterBaseAttrDict = new Dictionary <int, CharacterBaseAttr>();
     while (true)
     {
         CharacterPO agentPO = CharacterData.Instance.GetCharacterPO(mCharacterID);
         if (agentPO == null)
         {
             return;
         }
         mCharacterBaseAttrDict.Add(mCharacterID, new CharacterBaseAttr(agentPO));
         ++mCharacterID;
     }
 }
        public CharacterPO CharacterDOToPO(CharacterDO characterDO)
        {
            CharacterPO po = new CharacterPO();

            po.CharacterID    = characterDO.CharacterID;
            po.FirstName      = characterDO.FirstName;
            po.LastName       = characterDO.LastName;
            po.GameID         = characterDO.GameID;
            po.Alignment      = characterDO.Alignment;
            po.WeaponOfChoice = characterDO.WeaponOfChoice;
            po.Bio            = characterDO.Bio;
            po.MaleOrFemale   = characterDO.MaleOrFemale;
            return(po);
        }
        public CharacterDO CharacterPOToDO(CharacterPO po)
        {
            CharacterDO characterDO = new CharacterDO();

            characterDO.CharacterID    = po.CharacterID;
            characterDO.FirstName      = po.FirstName;
            characterDO.LastName       = po.LastName;
            characterDO.GameID         = po.GameID;
            characterDO.Alignment      = po.Alignment;
            characterDO.WeaponOfChoice = po.WeaponOfChoice;
            characterDO.Bio            = po.Bio;
            characterDO.MaleOrFemale   = po.MaleOrFemale;
            return(characterDO);
        }
Example #8
0
    static public void LoadHandler(LoadedData data)
    {
        JsonData jsonData = JsonMapper.ToObject(data.Value.ToString());

        if (!jsonData.IsArray)
        {
            return;
        }
        for (int index = 0; index < jsonData.Count; index++)
        {
            JsonData    element = jsonData[index];
            CharacterPO po      = new CharacterPO(element);
            CharacterData.Instance.m_dictionary.Add(po.Id, po);
        }
    }
Example #9
0
        public ActionResult CreateCharacter(long gameId)
        {
            ActionResult response = null;

            if ((Int64)Session["RoleID"] >= 2)
            {
                ViewBag.GameID = gameId;
                CharacterPO characterObject = new CharacterPO();
                response = View(characterObject);
            }
            else
            {
                response = RedirectToAction("Index", "Game");
            }
            return(response);
        }
Example #10
0
        public ActionResult UpdateCharacter(Int64 characterID, long gameId)
        {
            ActionResult response = null;

            if ((Int64)Session["RoleID"] >= 2)
            {
                ViewBag.GameID = gameId;
                CharacterMap map             = new CharacterMap();
                CharacterDO  characterObject = dl.ViewCharacterByID(characterID);
                CharacterPO  form            = map.CharacterDOToPO(characterObject);
                response = View(form);
            }
            else
            {
                response = RedirectToAction("CharacterIndex", new { gameID = gameId });
            }
            return(response);
        }
Example #11
0
        // GET: Character
        public ActionResult CharacterIndex(Int64 gameID)
        {
            ActionResult response = null;

            if (Session["UserName"] != null)
            {
                CharacterMap       map      = new CharacterMap();
                List <CharacterPO> fullList = new List <CharacterPO>();
                List <CharacterDO> allData  = dl.ViewCharactersByGame(gameID);
                foreach (CharacterDO data in allData)
                {
                    CharacterPO mappedData = map.CharacterDOToPO(data);
                    fullList.Add(mappedData);
                }
                ViewBag.GameId = gameID;
                response       = View(fullList);
            }
            else
            {
                response = RedirectToAction("Index", "Game");
            }
            return(response);
        }
Example #12
0
    /// <summary>
    /// 道具初始化
    /// </summary>
    /// <param name="po"></param>
    public override void InitPO(CharacterPO po0, CharacterRefreshPO po1)
    {
        _health     = po0.Health;
        _worth      = po0.Score;
        _baseSpeed  = po0.BaseSpeed;
        _attackTime = po0.AttackTime;
        mFogTime    = po0.FogTime;
        _freezeTime = po0.FreezeTime;
        _validTime  = po0.ValidTime;
        _agentType  = (global::E_AgentType)po0.Type;
        _agentID    = po0.Id;

        if (po1 != null)
        {
            _disappearTime = po1.DisappearTime;
        }
        else
        {
            _disappearTime = po0.DisappearTime;
        }

        _disappearType = _disappearTime == 0 ? E_DisappearType.Normal : E_DisappearType.CanDisappear;

        if (IsCoin())
        {
            InitCoin(_agentID);
        }

        if (IsSandBox())
        {
            InitSandBox();
        }

        _rigidbody = GetComponent <Rigidbody>();

        AddBornEffect(po0.BornEffect);
    }
Example #13
0
    public override void InitPO(CharacterPO po0, CharacterRefreshPO po1)
    {
        _health             = po0.Health;
        _worth              = po0.Score;
        _baseSpeed          = po0.BaseSpeed;
        _rotationSpeed      = po0.RotationSpeed;
        _agentID            = po0.Id;
        _agentType          = (E_AgentType)po0.Type;
        _destroyEffectSound = po0.DestroyEffectSound;
        _explodeEffectSound = po0.ExplodeEffectSound;
        _destroySound       = po0.DestroySound;
        _attackDamage       = po0.DamageValue;
        _invincible         = false;

        //_deadAfterAttack = po1.DadAfterDead == 1 ? true : false;
        //mMoveSpeed = _baseSpeed * UnityEngine.Random.Range(po1.FactorSpeed[0], po1.FactorSpeed[1]);

        _rigidbody = GetComponent <Rigidbody>();
        if (_rigidbody != null)
        {
            _rigidbody.isKinematic = po1.IsKinematic == 1 ? true : false;
        }

        //_reachTarget = false;

        _animator       = GetComponent <Animator>();
        _animator.speed = 1;

        //// 绑定出生特效
        //GameObject bornPoint = transform.Find("Root/BornEffectPoint").gameObject;
        //_bornEffect = PoolManager.Instance.Spawn(po0.BornEffect);
        //_bornEffect.transform.SetParent(bornPoint.transform);
        //ResetTransform(_bornEffect);

        ActionType = (global::E_ActionType)po1.ActionType;
        if (ActionType == global::E_ActionType.AttackCitizen)
        {
            _row = -1;
        }

        if (ActionType == global::E_ActionType.SpecialCircle)
        {
            stayArea = po1.StayArea;
            stayTime = UnityEngine.Random.Range(po1.StayTime[0], po1.StayTime[1]);
            InsertPosToPath(0, 1);
        }

        if (ActionType == global::E_ActionType.ShakeScreen)
        {
            _active  = false;
            stayArea = po1.StayArea;
            pathList.Clear();
            //pathList.AddRange(ioo.cameraManager.ShakeScreenList());
        }

        //_delayTimeAttack = po1.DelayTimeAttack;

        BindEvent();

        ConstructFSM();;
    }
Example #14
0
 /// <summary>
 /// 初始化数值  MonsterPO 后面可改,将玩家属性也陪到这里面来,统一整合为CharacterPO
 /// </summary>
 public virtual void InitPO(CharacterPO po0, CharacterRefreshPO po1)
 {
 }