/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="player">The player.</param> /// <param name="npc">The NPC.</param> /// <param name="constants">The constant assumptions.</param> /// <param name="friendship">The current friendship data.</param> public FriendshipModel(SFarmer player, NPC npc, Friendship friendship, ConstantData constants) { // flags this.CanDate = npc.datable.Value; this.IsDating = friendship.IsDating(); this.CanHousemate = npc.Name == "Krobus"; this.IsSpouse = friendship.IsMarried() && !this.CanHousemate; this.IsHousemate = friendship.IsMarried() && this.CanHousemate; this.IsDivorced = friendship.IsDivorced(); this.Status = friendship.Status; this.TalkedToday = friendship.TalkedToToday; this.GiftsToday = friendship.GiftsToday; this.GiftsThisWeek = friendship.GiftsThisWeek; // points this.MaxPoints = this.IsSpouse || this.IsHousemate ? constants.SpouseMaxFriendship : NPC.maxFriendshipPoints; this.Points = friendship.Points; this.PointsPerLevel = NPC.friendshipPointsPerHeartLevel; this.FilledHearts = this.Points / NPC.friendshipPointsPerHeartLevel; this.LockedHearts = this.CanDate && !this.IsDating ? constants.DatingHearts : 0; this.EmptyHearts = this.MaxPoints / NPC.friendshipPointsPerHeartLevel - this.FilledHearts - this.LockedHearts; if (this.IsSpouse || this.IsHousemate) { this.StardropPoints = constants.SpouseFriendshipForStardrop; this.HasStardrop = !player.mailReceived.Contains(Constants.Constant.MailLetters.ReceivedSpouseStardrop); } }
/// <summary> /// 检测是否在跟随范围内 /// </summary> /// <param name="dis"></param> /// <returns></returns> public bool CheckNavDistance(float dis) { Debug.Log("检测是否跟随攻击"); float distance = Vector3.Distance(ConstantData.GetInstance().Player.transform.position, ConstantData.GetInstance().currBoss.transform.position); return(Mathf.Abs(distance) < dis); }
public VariableEvaluator(GameBase gamebase, ConstantData constant) { this.gamebase = gamebase; this.constant = constant; varData = new VariableData(gamebase, constant); GlobalStatic.VariableData = varData; }
// Creates Constant wrapper private Constant CreateItem( // Fields of Constant table Guid ConstantId, int BitWidth, int Value, PinSide PinSide, string Note // Fields of Circuit table ) { TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit"); CircuitData dataCircuit = new CircuitData() { CircuitId = ConstantId }; RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit); ConstantData dataConstant = new ConstantData() { ConstantId = ConstantId, BitWidth = BitWidth, Value = Value, PinSide = PinSide, Note = Note, }; return(this.Create(this.Table.Insert(ref dataConstant), rowIdCircuit)); }
public void OnPlayRollDiceFinish() { RollDiceAni.Pause(); RollSrpite.TrySetComponentValue(string.Format(ConstantData.KeyRollDicePointFormat, _curData.ShowPoint)); RollSrpite.MakePixelPerfect(); if (!_curData.QuickModel) { ConstantData.PlaySoundBySex(_curData.Sex, string.Format(PointSoundFormat, _curData.ShowPoint)); CloudAni.Play(); if (_curData.OneMoreTime) { if (gameObject.activeInHierarchy) { if (_waitForOneMoreTimeCor != null) { StopCoroutine(_waitForOneMoreTimeCor); } _waitForOneMoreTimeCor = StartCoroutine(WaitShowOneMoreTime()); } } } else { CloudSprite.spriteName = ConstantData.KeyDefaultSpriteName; } }
public EtcsBrakingData() { Input = new InputData(); Middle = new MiddleData(); Output = new OutputData(); Params = new ConstantData(); }
public ConstView(FileSystemEntry entry) { _entry = entry; Columns.Add(new GridColumn { DataCell = new TextBoxCell { Binding = Binding.Property((ConstFileEntry r) => r.Index) }, HeaderText = "Index" }); Columns.Add(new GridColumn { DataCell = new TextBoxCell { Binding = Binding.Property((ConstFileEntry r) => r.Value) }, HeaderText = "Value" }); var constFile = ConstantData.FromFileSystemEntry(_entry); DataStore = constFile.Entries .Select((e, i) => new ConstFileEntry(e, i)) .ToList(); }
private void InitFacs() { LambdaFuncInt[] lfi = ConstantData.GetInstance().GetOnClickEvents(); string[][] st = ConstantData.GetInstance().GetFacilitiesInfo(); Resources tempPrice; Resources tmpProduct; for (int i = 0; i < st.Length; i++) { //make price tempPrice = new Resources(StringIntToIntArr(st[i][2])); tmpProduct = new Resources(StringIntToIntArr(st[i][5])); facs.Add(new Facility(Int32.Parse(st[i][0]), st[i][1], st[i][1] + "\n" + this.rm.GetFormattedResourceString(tmpProduct, true), "Activate " + st[i][1] + "\n" + this.rm.GetFormattedResourceString(tempPrice), tempPrice, tmpProduct, new Resources(StringIntToIntArr(st[i][3])), new Army(StringIntToIntArr(st[i][4])), new Army(StringIntToIntArr(st[i][6])), lfi[i] )); } facs[0].Activate(); }
/// <summary> /// 复活玩家 /// </summary> public void ResetPlayer() { ConstantData.GetInstance().Player.gameObject.SetActive(true); //ConstantData.GetInstance().Player.transform.position = new Vector3(ConstantData.GetInstance().Player.transform.position.x,0.5f, ConstantData.GetInstance().Player.transform.position.z); ConstantData.GetInstance().Player.GetComponent <PlayerBase>().InitPlayer(); ConstantData.GetInstance().Player.GetComponent <PlayerAnimCon>().Stand(); }
public void CheckAttack() { Collider[] colliders = Physics.OverlapSphere(transform.position, 2.5f, LayerMask.GetMask("Boss")); Debug.Log("Len" + colliders.Length); if (colliders.Length > 0) { for (int i = 0; i < colliders.Length; i++) { GameObject bosstemp = colliders[i].gameObject; //ConstantData.GetInstance().currBoss = bosstemp; //触发主角攻击 // AttackManager.GetInstance().PlayerAttack(transform.gameObject, bosstemp); //触发 boss 自动攻击 bosstemp.GetComponent <BossBase>().SetBossAttackState(true); //AttackManager.GetInstance().BossAutoAttack(bosstemp, transform.gameObject,2.0f); } GameObject currboss = colliders[0].gameObject; ConstantData.GetInstance().currBoss = currboss; //触发主角攻击 AttackManager.GetInstance().PlayerAttack(transform.gameObject, currboss); //触发 boss 自动攻击 currboss.GetComponent <BossBase>().SetBossAttackState(true); //AttackManager.GetInstance().BossAutoAttack(bosstemp, transform.gameObject,2.0f); Debug.Log("Attack the boss"); } }
public ConstantService(int capacity, ConstantData d) { _data = d; _dragCoeffData = new float[capacity]; _dragCoeffs = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(float))); CheckDragCoeffs(); }
/// <summary> /// boss 攻击 /// </summary> /// <param name="boss"></param> /// <param name="player"></param> public void BossAttack(GameObject boss, GameObject player) { //boss 攻击状态 且 player 存活 if (boss.GetComponent <BossBase>().GetBossAttackState() && player.GetComponent <PlayerBase>().GetPlayerState()) { //boss.GetComponent<BossBase>().SetBossAttackState(true); boss.transform.LookAt(player.transform); boss.GetComponent <BossAnimCon>().Attack(); float temp = player.GetComponent <PlayerBase>().GetPlayerBlood() - boss.GetComponent <BossBase>().GetBossAttack(); if (temp > 0) { player.GetComponent <PlayerBase>().SetPlayerBlood(player.GetComponent <PlayerBase>().GetPlayerBlood() - boss.GetComponent <BossBase>().GetBossAttack()); ConstantData.GetInstance().PlayerHUD.GetComponent <HUDText>().Add(-boss.GetComponent <BossBase>().GetBossAttack(), Color.red, 0.5f); Debug.Log(player.GetComponent <PlayerBase>().GetPlayerName() + " 血量" + player.GetComponent <PlayerBase>().GetPlayerBlood()); Debug.Log("血量减少" + boss.GetComponent <BossBase>().GetBossAttack()); } else { player.GetComponent <PlayerBase>().SetPlayerBlood(0); player.GetComponent <PlayerBase>().SetPlayerState(false); player.GetComponent <PlayerBase>().SetPlayerAttackState(false); player.GetComponent <PlayerBase>().SetPlayerAutoAttackState(false); boss.GetComponent <BossBase>().SetBossAttackState(false); StopAllCoroutines(); boss.GetComponent <BossAnimCon>().Stand(); player.GetComponent <PlayerAnimCon>().Dead(); PublicFuncs.GetInstance().WaitTimeDoFun(0.5f, () => { player.SetActive(false); }); } ConstantData.GetInstance().PlayerInfo.GetComponentInChildren <UISlider>().value = player.GetComponent <PlayerBase>().GetPlayerBlood() / 100f; } }
void Update() { //boss 当前为攻击状态 if (boss_attackstate) { timer -= Time.deltaTime; //检测寻路 if (CheckNavDistance(3f)) { bossnav.GetComponent <NavMeshAgent>().enabled = false; if (timer <= 0) { timer = TIME; AttackManager.GetInstance().BossAttack(transform.gameObject, ConstantData.GetInstance().Player); } } else if (CheckNavDistance(6f)) { bossnav.GetComponent <NavMeshAgent>().enabled = true; bossnav.destination = ConstantData.GetInstance().Player.transform.position; transform.GetComponent <BossAnimCon>().Run(); } //检测跟随攻击距离 CheckAttackDistance(6f); } }
public void ShowBossInfo(GameObject player, GameObject boss) { GameObject bossinfo = ConstantData.GetInstance().BossInfo; bossinfo.GetComponentInChildren <UISlider>().value = boss.GetComponent <BossBase>().GetBossBlood() / 100f; bossinfo.GetComponentInChildren <UILabel>().text = boss.GetComponent <BossBase>().GetBossName(); }
/// <summary> /// Gets and adds if necessary, the constant name for a group, name and value. /// </summary> /// <param name="group">The group for the constant.</param> /// <param name="name">The name for the constant.</param> /// <param name="value">The value for the constant.</param> /// <param name="commentText">The comment for the constant.</param> /// <returns>The name of the constant.</returns> public string this[string group, string name, string value, string commentText] { get { // Check to see if group is created Dictionary <string, ConstantData> ldConsts; if (!mdConstants.TryGetValue(group, out ldConsts)) { // If not create and add it ldConsts = new Dictionary <string, ConstantData>(); mdConstants[group] = ldConsts; } // Check to see if constant is created ConstantData lcdConstant; if (!ldConsts.TryGetValue(value, out lcdConstant)) { // If not create and add it lcdConstant = new ConstantData(MakeConstantName(group, name), commentText); ldConsts[value] = lcdConstant; } // Return constant name return(lcdConstant.Identifier); } }
public ConstantService(int capacity, ConstantData d) { _data = d; _dragCoeffData = new float[capacity]; _dragCoeffs = new ComputeBuffer (capacity, Marshal.SizeOf (typeof(float))); CheckDragCoeffs(); }
private GameObjectDefinition getChildDefinition() { int child = -1; if (varBitId != -1) { VarBit varBit = VarBit.values[varBitId]; int configId = varBit.configId; int lsb = varBit.leastSignificantBit; int msb = varBit.mostSignificantBit; int bit = ConstantData.GetBitfieldMaxValue(msb - lsb); child = clientInstance.GetInterfaceSettings(configId) >> lsb & bit; } else if (configId != -1) { child = clientInstance.GetInterfaceSettings(configId); } if (child < 0 || child >= childrenIds.Length || childrenIds[child] == -1) { return(null); } else { return(GameObjectDefinition.getDefinition(childrenIds[child])); } }
// Use this for initialization void Start() { if (instance == null) { instance = this; } ab = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/AssetsBundle/npcbundle"); }
/// <summary> /// 再来一次相关显示 /// </summary> /// <returns></returns> IEnumerator WaitShowOneMoreTime() { OneMoreTime.ResetToBeginning(); yield return(_waiteForOneMoreTimeYield); OneMoreTime.PlayForward(); ConstantData.PlaySoundBySex(_curData.Sex, ConstantData.KeyRollAgin); }
public static ConstantData GetInstance() { if (instance == null) { instance = new ConstantData(); } return(instance); }
public void CanReadConstFiles() { InstalledFilesTestData.ReadFiles(".const", _output, entry => { var constFile = ConstantData.FromFileSystemEntry(entry); Assert.NotNull(constFile); }); }
/// <summary> /// 奔跑动画 /// </summary> public void Run() { IsAttackWQState(0); //animation.Stop(); animation.clip = clips[0]; animation.Play(); animation.CrossFade("ZhanLi_TY", 2.5f); ConstantData.GetInstance().BossInfo.SetActive(false); ConstantData.GetInstance().BossHUD = null; }
public SeedData(MusicContext dataContext, ILogger <SeedData> log, IRepository repo, ConstantData constants) { context = dataContext; logger = log; repository = repo; Genres = constants.Genres; Occasions = constants.Occasions; Musicians = constants.Musicians; }
public void CheckBossActive() { //Debug.Log("检测boss 显示状态"); int len = ConstantData.GetInstance().BossList.Count; for (int i = 0; i < len; i++) { CheckDistance(ConstantData.GetInstance().BossList[i]); } }
public void CheckDistanceToStopAttack(float dis) { if (ConstantData.GetInstance().currBoss != null) { float distance = Vector3.Distance(ConstantData.GetInstance().Player.transform.position, ConstantData.GetInstance().currBoss.transform.position); if (Mathf.Abs(distance) > dis) { AttackManager.GetInstance().StopAttakc(); } } }
/// <summary> /// 设置键盘移动 /// </summary> public void ChangePlayerCon() { if (ConstantData.GetInstance().EasyTouchConToggle.GetComponent <UIToggle>().value) { ConstantData.GetInstance().Player.GetComponent <PlayerMove>().enabled = true; } else { ConstantData.GetInstance().Player.GetComponent <PlayerMove>().enabled = false; } }
/// <summary> /// 加载并初始化player /// </summary> private void InitPlayer() { GameObject playerprefab = LoadBundle("Player"); ConstantData.GetInstance().Player = Instantiate(playerprefab); GameObject playerhud = LoadBundle("PlayerHUD"); ConstantData.GetInstance().PlayerHUD = Instantiate(playerhud); ConstantData.GetInstance().PlayerHUD.GetComponent <UIFollowTarget>().target = ConstantData.GetInstance().Player.transform.Find("player_ui_point").transform; }
void setNewItem(object obj = null) { Item = new Item(); Item.CategoryId = ParentCategory.Id; Item.Unit = ConstantData.GetEnumName(ConstantData.Units.Kg); if (obj != null) { var entryObj = (Entry)obj; entryObj.Focus(); } }
/// <summary> /// 设置Bloom特效 /// </summary> public void ChangeBloomEffect() { if (ConstantData.GetInstance().BlommEffectToggle.GetComponent <UIToggle>().value) { ConstantData.GetInstance().BloomEffect.SetActive(true); } else { ConstantData.GetInstance().BloomEffect.SetActive(false); } }
public void fireBall(float powerScalar, Vector3 fireDir, Vector3 hitPoint) { HOAudioManager.FireBall(); GameManager.Rules.OnBallFired(); m_slowTime = 0; Vector3 fireForce = fireDir * powerScalar * ConstantData.GetPoolDatas().MaxImpulse; m_rigidbody.AddForceAtPosition(fireForce, hitPoint, ForceMode.Impulse); m_state = State.ROLL; OpenDrag(); }
/// <summary> /// 主角npc自动攻击协程 /// </summary> /// <returns></returns> private IEnumerator PlayerAutoAttack() { while (ConstantData.GetInstance().Player.GetComponent <PlayerBase>().GetPlayerAutoAttackState()) { Debug.Log("Player 开始自动攻击"); ConstantData.GetInstance().Player.GetComponent <PlayerAnimCon>().Attack(); ConstantData.GetInstance().Player.GetComponent <PlayerAnimCon>().CheckAttack(); yield return(new WaitForSeconds(2.0f)); Debug.Log("Player 自动攻击"); } }
public static int[] CharacterVarLength(VariableCode code, ConstantData constant) { int[] ret = null; VariableCode type = code & (VariableCode.__ARRAY_1D__ | VariableCode.__ARRAY_2D__ | VariableCode.__ARRAY_3D__ | VariableCode.__INTEGER__ | VariableCode.__STRING__); int i = (int)(code & VariableCode.__LOWERCASE__); if (i >= 0xF0) { return(null); } Int64 length64 = 0; switch (type) { case VariableCode.__STRING__: case VariableCode.__INTEGER__: ret = new int[0]; break; case VariableCode.__INTEGER__ | VariableCode.__ARRAY_1D__: ret = new int[1]; ret[0] = constant.CharacterIntArrayLength[i]; break; case VariableCode.__STRING__ | VariableCode.__ARRAY_1D__: ret = new int[1]; ret[0] = constant.CharacterStrArrayLength[i]; break; case VariableCode.__INTEGER__ | VariableCode.__ARRAY_2D__: ret = new int[2]; length64 = constant.CharacterIntArray2DLength[i]; ret[0] = (int)(length64 >> 32); ret[1] = (int)(length64 & 0x7FFFFFFF); break; case VariableCode.__STRING__ | VariableCode.__ARRAY_2D__: ret = new int[2]; length64 = constant.CharacterStrArray2DLength[i]; ret[0] = (int)(length64 >> 32); ret[1] = (int)(length64 & 0x7FFFFFFF); break; case VariableCode.__INTEGER__ | VariableCode.__ARRAY_3D__: throw new NotImplCodeEE(); case VariableCode.__STRING__ | VariableCode.__ARRAY_3D__: throw new NotImplCodeEE(); } return(ret); }
public ConstantService(ConstantData d) { _data = d; }
/// <summary> /// Gets and adds if necessary, the constant name for a group, name and value. /// </summary> /// <param name="group">The group for the constant.</param> /// <param name="name">The name for the constant.</param> /// <param name="value">The value for the constant.</param> /// <param name="commentText">The comment for the constant.</param> /// <returns>The name of the constant.</returns> public string this[string group, string name, string value, string commentText] { get { // Check to see if group is created Dictionary<string, ConstantData> ldConsts; if (!mdConstants.TryGetValue(group, out ldConsts)) { // If not create and add it ldConsts = new Dictionary<string, ConstantData>(); mdConstants[group] = ldConsts; } // Check to see if constant is created ConstantData lcdConstant; if (!ldConsts.TryGetValue(value, out lcdConstant)) { // If not create and add it lcdConstant = new ConstantData(MakeConstantName(group, name), commentText); ldConsts[value] = lcdConstant; } // Return constant name return lcdConstant.Identifier; } }