/// <summary> /// Create a contract for specified player. /// </summary> public CContract GenerateContract(int PlayerID) { CContract contract = CEntity.Create <CContract>(_world); contract.InitContract(this, mPlayerTier[PlayerID], PlayerID); return(contract); }
public void OnCreate(CEntity owner, string id, byte skin) { if (skin != 0xff) { int actionId = skin >> 4; id = $"{id}_{actionId}"; } this.owner = owner; this.OnCreate(this.owner.battle, id); this.animator.OnCreate(this.model.GetComponent <Animator>()); this.audioSource.OnCreate(this.model.GetComponent <AudioSource>()); Renderer renderer; Transform skinTr = this.model.Find("Skin"); if (skinTr != null) { renderer = skinTr.GetComponent <Renderer>(); } else { renderer = this.model.GetComponentInChildren <Renderer>(); } if (skin != 0xff) { int imageId = skin & 0xF; Material resources = Resources.Load <Material>($"{MATERIAL_PATH}{id}_{imageId}"); if (resources == null) { resources = Resources.Load <Material>($"{MATERIAL_PATH}failed"); } renderer.material = Object.Instantiate(resources); } this.material.OnCreate(renderer); }
public override void OnEnterState() { base.OnEnterState(); m_attirCom = Entity.GetComponent <CAttributeCom>(); m_moveSpeed = m_attirCom.GetAttr(E_AttributeType.MoveSpeed) / 10f; m_moveGobj = Entity.GetComponent <CRenderCom>().GameObject; var attackCom = Entity.GetComponent <CAttackCom>(); var battleSys = CBattleEntityMgr.Instance.GetSystem <CBattleEntitySys>(); m_targetEntity = battleSys.FindEntityByID(attackCom.TargetID); if (null == m_targetEntity) { //back to idle StateTransite((int)E_RoleState.Idle); return; } //look at target var targetRenderer = m_targetEntity.GetComponent <CRenderCom>(); //m_moveGobj.transform.LookAt(targetRenderer.GameObject.transform); SetLookAt(m_moveGobj.transform, targetRenderer.GameObject.transform); var animCom = this.Entity.GetComponent <CAnimCom>(); animCom.ForcePlayAnim(E_AnimatorState.walk); }
//* ────________________________________* //* methods ───────────────────────────────-* //* -----------------------------------------------------------------------* /// <summary> /// <para>状態が開始された時に呼び出されます。</para> /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para> /// </summary> /// /// <param name="entity">この状態を適用されたオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> public override void setup(CEntity entity, CGame privateMembers) { base.setup(entity, privateMembers); alpha = 0; mgrCo.Add(coAlpha()); CPresenceSender.sendAtCredit(); }
//----------------------------------------------------------------------------- public override object save(string serializer_name, CEntity entity, CEntityDef entity_def, object param) { string db_key = entity.getEntityType() + "_" + entity.getEntityId(); Dictionary <string, object> map_prop = entity_def.getMapPropertyValue(); string json_map_prop = JsonConvert.SerializeObject(map_prop); Enyim.Caching.Memcached.Results.IStoreOperationResult ret = CCouchbaseClient.Instance.ExecuteStore(StoreMode.Set, db_key, json_map_prop, Couchbase.Operations.PersistTo.Zero); if (ret.Success) { //mLog.Info("-------- Db Begin --------"); //mLog.Info("CEntitySerializerDb save entity to db: entity_type=" + entity.getEntityType() + " entity_id=" + entity.getEntityId()); //mLog.Info("-------- Db End --------"); } else { //mLog.Error("CEntitySerializerDb::save() error! "); //mLog.Error("save entity to db: entity_type=" + entity.getEntityType() + " entity_id=" + entity.getEntityId()); //mLog.Error(ret.Message); //mLog.Error(json_map_prop); } return(null); }
private void InspectEntity(SEntityId entityId) { CEngine engine = CEngine.Instance; engine.Dispatch(EEngineUpdatePriority.BeginFrame, () => { CUpdateScheduler scheduler = engine.CurrentWorld.UpdateScheduler; if (m_updateScope != null && m_updateScope.IsConnected()) { scheduler.Disconnect(m_updateScope); } CEntity entity = entityId.GetEntity(); if (entity != null) { m_selectedObject = new CEditableObject(entityId); m_updateScope = scheduler.Connect(UpdateCallback, EUpdatePriority.ResourceLoading); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)(() => { m_desiredTarget = new CEditableObject(entityId); UnmarkEverything(); MarkEntityInInspector(true); })); } }); }
private void LoadEntity(CEntity entity) { var attributeCom = entity.GetComponent <CAttributeCom>(); var gobj = ResourceMgr.Instance.Load(E_ResourceType.Model, attributeCom.Config.AssetName); GameObject newGobj = GameObject.Instantiate(gobj); newGobj.name = attributeCom.Config.Name; var renderCom = entity.GetComponent <CRenderCom>(); renderCom.GameObject = newGobj; string initRootName = "TeamA"; if (attributeCom.BattleGroupType == E_BattleGroupType.Enemy) { initRootName = "TeamB"; } var bornPoint = SceneGlobal.Root3D.Find(initRootName); renderCom.GameObject.transform.position = bornPoint.position; if (attributeCom.BattleGroupType == E_BattleGroupType.Teammate) { renderCom.GameObject.transform.localEulerAngles = Vector3.zero; } else if (attributeCom.BattleGroupType == E_BattleGroupType.Enemy) { renderCom.GameObject.transform.localEulerAngles = new Vector3(0, 180f, 0); } renderCom.GameObject.transform.SetParent(bornPoint, true); var canimCom = entity.GetComponent <CAnimCom>(); canimCom.Animator = newGobj.GetComponent <Animator>(); renderCom.InitFinish(); }
//* ────────────-_______________________* //* constructor & destructor ───────────────────────* //* -----------------------------------------------------------------------* /// <summary>コンストラクタ。</summary> private CCursor() : base(CStateCursor.instance) { locate = Point.Zero; aiView = new CEntity(null, this); level = 0; }
//* ────________________________________* //* methods ───────────────────────────────-* //* -----------------------------------------------------------------------* /// <summary> /// <para>状態が開始された時に呼び出されます。</para> /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para> /// </summary> /// /// <param name="entity">この状態を適用されたオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> public override void setup(CEntity entity, CGame privateMembers) { CGame.instance.bgColor = bgColor; description.gradationMode = false; taskManager.Add(description); base.setup(entity, privateMembers); }
static int _m_setMoveArgs(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CEntity __cl_gen_to_be_invoked = (CEntity)translator.FastGetCSObj(L, 1); { float dis = (float)LuaAPI.lua_tonumber(L, 2); float speed = (float)LuaAPI.lua_tonumber(L, 3); float att = (float)LuaAPI.lua_tonumber(L, 4); int dirType = LuaAPI.xlua_tointeger(L, 5); __cl_gen_to_be_invoked.setMoveArgs(dis, speed, att, dirType); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public static void DetachEntityFromAllParents(SEntityId entityId) { CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () => { CEntity target = entityId.GetEntity(); if (target == null || target.RootComponent == null || target.RootComponent.ParentComponent == null) { return; } SEntityComponentId oldRootParent = new SEntityComponentId(target.RootComponent.ParentComponent); void Do() { CWorld world = CEngine.Instance.CurrentWorld; CEntity entity = entityId.GetEntity(); if (entity != null) { entity.Detach(); } } void Undo() { CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () => { CWorld world = CEngine.Instance.CurrentWorld; CEntity entity = entityId.GetEntity(); CSceneComponent oldParent = oldRootParent.GetComponent <CSceneComponent>(); if (oldParent == null) { LogUtility.Log("[UndoRedo] The old parent is invalid! Undo stack has been corrupted and cleared."); UndoRedoUtility.Purge(null); return; } if (entity != null) { entity.AttachToComponent(oldParent); } }); } void Redo() { CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () => { Do(); }); } Do(); CRelayUndoItem item = new CRelayUndoItem(Undo, Redo); UndoRedoUtility.Record(item); }); }
public static void EntityDestroied(CEntity target) { UIEvent e = Get(); e.type = UIEventType.ENTITY_DESTROIED; e.target = target; e.Invoke(); }
//* -----------------------------------------------------------------------* /// <summary>1フレーム分の更新処理を実行します。</summary> /// /// <param name="entity">この状態を適用されているオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> /// <param name="gameTime">前フレームが開始してからの経過時間。</param> public override void update(CEntity entity, CGame privateMembers, GameTime gameTime) { if (inputData[(int)EInputActionMap.cancel].push) { CGame.instance.Exit(); } base.update(entity, privateMembers, gameTime); }
//* -----------------------------------------------------------------------* /// <summary>1フレーム分の更新処理を実行します。</summary> /// /// <param name="entity">この状態を適用されているオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> /// <param name="gameTime">前フレームが開始してからの経過時間。</param> public override void update(CEntity entity, CGame privateMembers, GameTime gameTime) { base.update(entity, privateMembers, gameTime); if (mgrCo.Count == 0) { entity.nextState = CSceneGame.instance; } }
//* -----------------------------------------------------------------------* /// <summary>1フレーム分の描画処理を実行します。</summary> /// /// <param name="entity">この状態を適用されているオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> /// <param name="gameTime">前フレームが開始してからの経過時間。</param> public override void draw(CEntity entity, CGame privateMembers, GameTime gameTime) { mgrCo.draw(gameTime); CGame.sprite.add(CONTENT.texLogo, new Vector2(320, 200), EAlign.Center, EAlign.Center, new Rectangle(0, 0, 384, 384), new Color(Color.White, alpha), 0f, SpriteBlendMode.AlphaBlend); base.draw(entity, privateMembers, gameTime); }
//* -----------------------------------------------------------------------* /// <summary>1フレーム分の更新処理を実行します。</summary> /// /// <param name="entity">この状態を適用されているオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> /// <param name="gameTime">前フレームが開始してからの経過時間。</param> public override void update(CEntity entity, CGame privateMembers, GameTime gameTime) { if (entity.counter - entity.lastStateChangeCounter >= 30) { entity.nextState = CSceneMenu.instance; } base.update(entity, privateMembers, gameTime); }
public static void EntityCreated(CEntity target) { UIEvent e = Get(); e.type = UIEventType.ENTITY_CREATED; e.target = target; e.Invoke(); }
//* ────________________________________* //* methods ───────────────────────────────-* //* -----------------------------------------------------------------------* /// <summary> /// <para>状態が開始された時に呼び出されます。</para> /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para> /// </summary> /// /// <param name="entity">この状態を適用されたオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> public override void setup(CEntity entity, CGame privateMembers) { base.setup(entity, privateMembers); CGame.instance.bgColor = bgColor; description.gradationMode = false; taskManager.Add(description); CPresenceSender.sendAtJudge(this); }
public void OnEntityAttrChanged(CEntity target, Attr attr, object value) { if (!this._idToHud.TryGetValue(target.rid, out HUD hud)) { return; } hud.OnEntityAttrChanged(attr, value); }
//* ────________________________________* //* methods ───────────────────────────────-* //* -----------------------------------------------------------------------* /// <summary> /// <para>状態が開始された時に呼び出されます。</para> /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para> /// </summary> /// /// <param name="entity">この状態を適用されたオブジェクト。</param> /// <param name="privateMembers"> /// オブジェクトと状態クラスのみがアクセス可能なフィールド。 /// </param> public override void setup(CEntity entity, CGame privateMembers) { base.setup(entity, privateMembers); CBall.enemy.nextState = CStateEnemy.instance; CBall.player.nextState = CStatePlayer.instance; taskManager.Add(CBall.enemy); taskManager.Add(CBall.player); print(new Point(40, 20), EAlign.Center, Color.DarkRed, Resources.ROLL_SPACE); }
private void OnCreateEntity(object e) { CEntity emptyEntity = new CEntity(); emptyEntity.Name = "Entity"; CEntityAsset <CEntity> .CreateFromEntity(emptyEntity, ActiveDirectory); UpdateShownAssets(); }
public override void Update(CEntity entity) { CFsmCom fsmCom = entity.GetComponent <CFsmCom>(); if (fsmCom.FsmMgr != null) { fsmCom.FsmMgr.Update(); } }
public void SaveFormC(CEntity cc, int year, int userId) { DataSet dsUsers = new DataSet(); SpParamCollection spParams = new SpParamCollection(); sqlConn = new SqlConnection(m_connectionString); spParams.Add(new SpParam("@userID", userId)); spParams.Add(new SpParam("@shares_script_description", cc.shares_script_description)); spParams.Add(new SpParam("@shares_facevalue", cc.shares_facevalue)); spParams.Add(new SpParam("@shares_purchase_consideration", cc.shares_purchase_consideration)); spParams.Add(new SpParam("@shares_howacquired", cc.shares_howacquired)); spParams.Add(new SpParam("@shares_relationship", cc.shares_relationship)); spParams.Add(new SpParam("@debenture_script_description", cc.debenture_script_description)); spParams.Add(new SpParam("@debenture_facevalue", cc.debenture_facevalue)); spParams.Add(new SpParam("@debenture_purchase_consideration", cc.debenture_purchase_consideration)); spParams.Add(new SpParam("@debenture_howacquired", cc.debenture_howacquired)); spParams.Add(new SpParam("@debenture_relationship", cc.debenture_relationship)); spParams.Add(new SpParam("@units_script_description", cc.units_script_description)); spParams.Add(new SpParam("@units_facevalue", cc.units_facevalue)); spParams.Add(new SpParam("@units_purchase_consideration", cc.units_purchase_consideration)); spParams.Add(new SpParam("@units_howacquired", cc.units_howacquired)); spParams.Add(new SpParam("@units_relationship", cc.units_relationship)); spParams.Add(new SpParam("@nscs_script_description", cc.nscs_script_description)); spParams.Add(new SpParam("@nscs_facevalue", cc.nscs_facevalue)); spParams.Add(new SpParam("@nscs_purchase_consideration", cc.nscs_purchase_consideration)); spParams.Add(new SpParam("@nscs_howacquired", cc.nscs_howacquired)); spParams.Add(new SpParam("@nscs_relationship", cc.nscs_relationship)); spParams.Add(new SpParam("@nss_script_description", cc.nss_script_description)); spParams.Add(new SpParam("@nss_facevalue", cc.nss_facevalue)); spParams.Add(new SpParam("@nss_purchase_consideration", cc.nss_purchase_consideration)); spParams.Add(new SpParam("@nss_howacquired", cc.nss_howacquired)); spParams.Add(new SpParam("@nss_relationship", cc.nss_relationship)); spParams.Add(new SpParam("@allbank_script_description", cc.allbank_script_description)); spParams.Add(new SpParam("@allbank_facevalue", cc.allbank_facevalue)); spParams.Add(new SpParam("@allbank_purchase_consideration", cc.allbank_purchase_consideration)); spParams.Add(new SpParam("@allbank_howacquired", cc.allbank_howacquired)); spParams.Add(new SpParam("@allbank_relationship", cc.allbank_relationship)); spParams.Add(new SpParam("@othersecurity_script_description", cc.othersecurity_script_description)); spParams.Add(new SpParam("@othersecurity_facevalue", cc.othersecurity_facevalue)); spParams.Add(new SpParam("@othersecurity_purchase_consideration", cc.othersecurity_purchase_consideration)); spParams.Add(new SpParam("@othersecurity_howacquired", cc.othersecurity_howacquired)); spParams.Add(new SpParam("@othersecurity_relationship", cc.othersecurity_relationship)); spParams.Add(new SpParam("@allother_script_description", cc.allother_script_description)); spParams.Add(new SpParam("@allother_facevalue", cc.allother_facevalue)); spParams.Add(new SpParam("@allother_purchase_consideration", cc.allother_purchase_consideration)); spParams.Add(new SpParam("@allother_howacquired", cc.allother_howacquired)); spParams.Add(new SpParam("@allother_relationship", cc.allother_relationship)); spParams.Add(new SpParam("@year", year)); DBHelper.ExecProcNonQuery("SaveFormC", spParams, sqlConn); }
public static void EntityAttrChanged(CEntity target, Attr attr, object value) { UIEvent e = Get(); e.type = UIEventType.ENTITY_ATTR_CHANGED; e.target = target; e.attr = attr; e.o0 = value; e.Invoke(); }
private bool CheckTargetValid(CEntity targetEntity) { if (null == targetEntity) { return(false); } var atriCom = targetEntity.GetComponent <CAttributeCom>(); return(atriCom.IsAlive()); }
private CEntity get(long uid) { CEntity ce = null; if (entityPool.ContainsKey(uid)) { ce = entityPool[uid]; } return(ce); }
protected void btnSave_Click(object sender, EventArgs e) { CEntity cc = new CEntity(); cc.shares_script_description = Utils.GetStringValue(shares_script_description.Value); cc.shares_facevalue = Utils.GetDoubleValue(shares_facevalue.Value); cc.shares_purchase_consideration = Utils.GetDoubleValue(shares_purchase_consideration.Value); cc.shares_howacquired = Utils.GetStringValue(shares_howacquired.Value); cc.shares_relationship = Utils.GetStringValue(shares_relationship.Value); cc.debenture_script_description = Utils.GetStringValue(debenture_script_description.Value); cc.debenture_facevalue = Utils.GetDoubleValue(debenture_facevalue.Value); cc.debenture_purchase_consideration = Utils.GetDoubleValue(debenture_purchase_consideration.Value); cc.debenture_howacquired = Utils.GetStringValue(debenture_howacquired.Value); cc.debenture_relationship = Utils.GetStringValue(debenture_relationship.Value); cc.units_script_description = Utils.GetStringValue(units_script_description.Value); cc.units_facevalue = Utils.GetDoubleValue(units_facevalue.Value); cc.units_purchase_consideration = Utils.GetDoubleValue(units_purchase_consideration.Value); cc.units_howacquired = Utils.GetStringValue(units_howacquired.Value); cc.units_relationship = Utils.GetStringValue(units_relationship.Value); cc.nscs_script_description = Utils.GetStringValue(nscs_script_description.Value); cc.nscs_facevalue = Utils.GetDoubleValue(nscs_facevalue.Value); cc.nscs_purchase_consideration = Utils.GetDoubleValue(nscs_purchase_consideration.Value); cc.nscs_howacquired = Utils.GetStringValue(nscs_howacquired.Value); cc.nscs_relationship = Utils.GetStringValue(nscs_relationship.Value); cc.nss_script_description = Utils.GetStringValue(nss_script_description.Value); cc.nss_facevalue = Utils.GetDoubleValue(nss_facevalue.Value); cc.nss_purchase_consideration = Utils.GetDoubleValue(nss_purchase_consideration.Value); cc.nss_howacquired = Utils.GetStringValue(nss_howacquired.Value); cc.nss_relationship = Utils.GetStringValue(nss_relationship.Value); cc.allbank_script_description = Utils.GetStringValue(allbank_script_description.Value); cc.allbank_facevalue = Utils.GetDoubleValue(allbank_facevalue.Value); cc.allbank_purchase_consideration = Utils.GetDoubleValue(allbank_purchase_consideration.Value); cc.allbank_howacquired = Utils.GetStringValue(allbank_howacquired.Value); cc.allbank_relationship = Utils.GetStringValue(allbank_relationship.Value); cc.othersecurity_script_description = Utils.GetStringValue(othersecurity_script_description.Value); cc.othersecurity_facevalue = Utils.GetDoubleValue(othersecurity_facevalue.Value); cc.othersecurity_purchase_consideration = Utils.GetDoubleValue(othersecurity_purchase_consideration.Value); cc.othersecurity_howacquired = Utils.GetStringValue(othersecurity_howacquired.Value); cc.othersecurity_relationship = Utils.GetStringValue(othersecurity_relationship.Value); cc.allother_script_description = Utils.GetStringValue(allother_script_description.Value); cc.allother_facevalue = Utils.GetDoubleValue(allother_facevalue.Value); cc.allother_purchase_consideration = Utils.GetDoubleValue(allother_purchase_consideration.Value); cc.allother_howacquired = Utils.GetStringValue(allother_howacquired.Value); cc.allother_relationship = Utils.GetStringValue(allother_relationship.Value); UserBL userBL = new UserBL(); int year = Utils.GetIntValue(Request["Year"]); UserEntity user = Session[Constants.USERSESSIONVAR] as UserEntity; userBL.SaveFormC(cc, year, user.UserId); }
public static bool CheckTargetInAttackRange(CEntity attacker, CEntity target) { var attackerRender = attacker.GetComponent <CRenderCom>(); var targetRender = target.GetComponent <CRenderCom>(); Vector3 posA = attackerRender.GameObject.transform.position; Vector3 posB = targetRender.GameObject.transform.position; // float attackRange = attacker.GetComponent<CAttributeCom>().GetAttr(E_AttributeType.); float attackRange = 0.5f; return(Vector3.Distance(posA, posB) <= attackRange); }
public override void Placeholder() { var centity = new CEntity(); Writer.WriteStruct(centity); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); Writer.Write(0); }
public SCollisionEventData(CEntity a, CEntity b, Entity physA, Entity physB, Contact contact) { EntityA = a; EntityB = b; Location = contact.Position.ToSharp(); Normal = contact.Normal.ToSharp(); VelocityA = physA?.LinearVelocity.ToSharp() ?? Vector3.Zero; VelocityB = physB?.LinearVelocity.ToSharp() ?? Vector3.Zero; }
// 데이터 로드 public bool LoadData() { base.LoadData(); m_tmControlCsv.Clear(); // 데이터 재 정렬 bool bClear = true; // 무결성 체크 String strTemp; String preAppName = ""; foreach(KeyValuePair<int, StData> kData in m_tmData) { if (0 == kData.Value.m_strLine.Length) continue; EControlIniFileRet ret = isRightAppName(kData.Value.m_strLine, out strTemp); if (EControlIniFileRet.Succend == ret) { if (!m_tmControlCsv.ContainsKey(strTemp)) { preAppName = strTemp; CEntity kEntity = new CEntity(); m_tmControlCsv.Add(strTemp, kEntity); } else { strTemp = String.Format("CControlCsvFileLikeIni - m_tmControlCsv Same Key{0} ]", strTemp); Debug.Log(strTemp); bClear = false; } } else if (EControlIniFileRet.Failed_NotAppName == ret && 2 < preAppName.Length) { CEntity kEntity; if (m_tmControlCsv.TryGetValue(preAppName, out kEntity)) { if (!kEntity.AddNode(kData.Value.m_strComma[0], kData.Value.m_strComma[1])) { strTemp = String.Format("kEntity.AddNode Failed SameKey[ {0} ]", kData.Value.m_strComma[0]); Debug.Log(strTemp); bClear = false; } } } else { strTemp = String.Format("CControlCsvFileLikeIni - LoadData Failed[ {0} ] Text [ {1} ]", ret, kData.Value.m_strLine); Debug.Log(strTemp); bClear = false; } } return bClear; }