// 填充時轉向 protected virtual void RotateToDefenseSide( UnitData _unitData ) { Vector3 vecToTarget = Vector3.zero ; Vector3 norVecToTarget = Vector3.zero ; float angleOfTarget = 0.0f ; float dotOfUp = 0.0f ; Vector3 shieldWeightDir = _unitData.FindShieldWeightDirection() ; if( shieldWeightDir != Vector3.zero ) { // Debug.Log( "shieldWeightDir" + shieldWeightDir ) ; if( true == MathmaticFunc.FindTargetRelationWithForward( this.gameObject , shieldWeightDir , m_TargetNow.Obj.transform.position , ref vecToTarget , ref norVecToTarget , ref angleOfTarget , ref dotOfUp ) ) { // angular speed _unitData.AngularRatioHeadTo( angleOfTarget , dotOfUp , 0.1f ) ; } } }
public void LevelUp() { if (level >= 5) return; if(exp >= expToLevelUp[level - 1]) { battleParameters = battleParameters.combine(levelUpChange[level - 1]); level++; } }
public new void init(UnitData uData) { base.init(uData); memory = uData.memory; impulse = uData.impulse; mPool = new int[5]; crystals = new List<CrystalObject>(); cardsPlayed = new List<Card>(); resetHeroTurn(); }
// Use this for initialization void Start () { if( null == s_Manager ) { GameObject obj = GameObject.Find( "GlobalSingleton" ) ; s_Manager = obj.GetComponent<KandyCrusherManager>() ; } m_UnitData = this.gameObject.GetComponent<UnitData>() ; m_PressDown = false ; }
// 檢查武器並移動 , 會檢查是在範圍內 還是不能發射 protected override bool CheckWeaponAndMoveToTarget( UnitData _unitData , UnitWeaponSystem _weaponSys , Vector3 _TargetPosition ) { string weaponInRange = "" ; Vector3 vecToTarget = Vector3.zero ; Vector3 norVecToTarget = Vector3.zero ; float angleOfTarget = 0.0f ; float dotOfUp = 0.0f ; string IMPLUSE_ENGINE_RATIO = ConstName.UnitDataComponentImpulseEngineRatio ; // 剛轉換過來不要檢查武器 if( m_State.ElapsedFromLast() > 0.5f ) { // check fire phaser weapon is available weaponInRange = _weaponSys.FindAbleToShootTargetWeaponComponent( RandomAWeaponKeyword() , m_TargetNow.Obj ) ; // Debug.Log( "weaponInRange=" + weaponInRange) ; if( 0 != weaponInRange.Length ) { this.SetState( AI_Fire_State.StopAndFireToTarget ) ; return true ; } } // move to target if( true == MathmaticFunc.FindTargetRelation( this.gameObject , _TargetPosition , ref vecToTarget , ref norVecToTarget , ref angleOfTarget , ref dotOfUp ) ) { if( true == _unitData.standardParameters.ContainsKey( IMPLUSE_ENGINE_RATIO ) ) { // speed to maximum if( vecToTarget.sqrMagnitude > m_MaximumWeaponRange * m_MaximumWeaponRange ) _unitData.standardParameters[ IMPLUSE_ENGINE_RATIO ].ToMax() ; else _unitData.standardParameters[ IMPLUSE_ENGINE_RATIO ].Clear() ; } // angular speed _unitData.AngularRatioHeadTo( angleOfTarget , dotOfUp , 0.1f ) ; } return false ; }
void PowerUp( UnitData _unitData ) { // Debug.Log( "PowerUp" ) ; if( null == _unitData ) return ; foreach( UnitComponentData componentData in _unitData.componentMap.Values ) { componentData.m_Energy.ToMax() ; } if( 0 != m_AddAIName.Length ) { this.gameObject.AddComponent( m_AddAIName ) ; } }
public UnitData combine(UnitData data) { UnitData newData = new UnitData(); newData.attack = attack + data.attack; newData.defense = defense + data.defense; newData.damage = damage + data.damage; newData.armor = armor + data.armor; newData.hitPoints = hitPoints + data.hitPoints; newData.actionPoints = actionPoints + data.actionPoints; newData.speed = speed + data.speed; newData.critStrike = critStrike + data.critStrike; newData.critBlock = critBlock + data.critBlock; return newData; }
void Awake() { tGroup = this.transform.GetComponentsInChildren<Transform>(); startColor = new Color[tGroup.Length]; nManager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent<NetworkManager>(); uData = this.transform.GetComponent<UnitData>(); int i = 0; foreach(Transform t in tGroup) { if(t.renderer) { startColor[i] = t.renderer.material.color; i++; } } }
// Use this for initialization void Start () { if( null == s_Manager ) { GameObject globalSingleton = GameObject.Find( "GlobalSingleton" ) ; if( null != globalSingleton ) { s_Manager = globalSingleton.GetComponent<TripleTaoManager>() ; } } if( null == m_UnitData ) { m_UnitData = this.gameObject.GetComponent<UnitData>() ; } }
UnitData Load(string _FilePathName) { string filepath = s_Path + _FilePathName; TextAsset textAsset = Resources.Load(filepath) as TextAsset; if (!textAsset) { GlobalSingleton.ERROR("Load unit data failed : " + filepath); return null; } UnitData data = new UnitData(); if (false == data.DoParse(textAsset.text)) { GlobalSingleton.ERROR("Parse unit data failed : " + textAsset.text); return null; } return data; }
// Processes a hit public void hit(float[] attackParams) { if(attackParams.Length != NUM_PARAMS){ return; } if(unitData.Team == UnitData.TEAM_PLAYER){ print("Playerhit"); } // Attack is valid if the attacker team and this unit's team are different if(unitData != null){ if(unitData.Team != attackParams[(int)ATTACK_PARAMS.attackerTeam]){ // modifyhealth is managed by the unitdata script unitData.SendMessage("modifyHealth",-attackParams[(int)ATTACK_PARAMS.damage]); } }else{ unitData = this.GetComponent<UnitData>(); } }
// 前往第二目標 protected bool CheckMoveToTarget( UnitData _unitData , UnitWeaponSystem _weaponSys , Vector3 _TargetPosition , float _ImpulseSpeed = 1.0f ) { Vector3 vecToTarget = Vector3.zero ; Vector3 norVecToTarget = Vector3.zero ; float angleOfTarget = 0.0f ; float dotOfUp = 0.0f ; string IMPLUSE_ENGINE_RATIO = ConstName.UnitDataComponentImpulseEngineRatio ; if( true == MathmaticFunc.FindTargetRelation( this.gameObject , _TargetPosition , ref vecToTarget , ref norVecToTarget , ref angleOfTarget , ref dotOfUp ) ) { if( vecToTarget.sqrMagnitude < m_ReachDistanceSquare ) { this.SetState( AI_Fire_State.MoveToTarget ) ; return true ; } if( true == _unitData.standardParameters.ContainsKey( IMPLUSE_ENGINE_RATIO ) ) { _unitData.standardParameters[ IMPLUSE_ENGINE_RATIO ].now = _unitData.standardParameters[ IMPLUSE_ENGINE_RATIO ].max * _ImpulseSpeed ; } // angular speed _unitData.AngularRatioHeadTo( angleOfTarget , dotOfUp , 0.1f ) ; } return false ; }
public float calcDamage(UnitData opponent, float actionDamage) { float actualAttack = attack - attack * 0.1f + Random.Range(0.0f, 1.0f) * attack * 0.2f; float actualDefense = opponent.defense - opponent.defense * 0.1f + Random.Range(0.0f, 1.0f) * opponent.defense * 0.2f; float mad = actualAttack / actualDefense / 10; if(actualAttack < actualDefense){ mad = -mad; } float damageValue = damage + damage * mad; bool isCrit = false; if(Random.Range(0.0f, 1.0f) < critStrike){ damageValue *= 1.5f; isCrit = true; } if(Random.Range(0.0f, 1.0f) < opponent.critBlock){ return 0; } return damageValue / (damageValue + opponent.armor) * damageValue * actionDamage; }
public void GetUnitData(string _TypeName, ref UnitData _UnitDataRef) { if (!m_DataTemplateContainer.ContainsKey(_TypeName)) { UnitData data = new UnitData(); data.m_HP.Set(10, 0); data.m_ATK.Set(12,8); data.m_DEF.Set(1, 1); m_DataTemplateContainer.Add(_TypeName, data); } if ((_UnitDataRef != null) && m_DataInstanceContainer.ContainsKey(_UnitDataRef.m_InstanceID)) { m_DataInstanceContainer.Remove(_UnitDataRef.m_InstanceID); _UnitDataRef = null; } _UnitDataRef = new UnitData(); _UnitDataRef.Copy(m_DataTemplateContainer[_TypeName]); _UnitDataRef.m_InstanceID = s_UniqueInstanceID++; m_DataInstanceContainer.Add(_UnitDataRef.m_InstanceID, _UnitDataRef); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is UnitData)) { return; } UnitData mData = (UnitData)data; this.instanceID = mData.instanceID; if (mData.identity != null) { this.identity = (UnitIdentityData)mData.identity.clone(); } else { this.identity = null; nullObjError("identity"); } if (mData.normal != null) { this.normal = (UnitNormalData)mData.normal.clone(); } else { this.normal = null; nullObjError("normal"); } if (mData.pos != null) { this.pos = (UnitPosData)mData.pos.clone(); } else { this.pos = null; } if (mData.avatar != null) { this.avatar = (UnitAvatarData)mData.avatar.clone(); } else { this.avatar = null; } if (mData.move != null) { this.move = (UnitMoveData)mData.move.clone(); } else { this.move = null; } if (mData.fight != null) { this.fight = (UnitFightData)mData.fight.clone(); } else { this.fight = null; } if (mData.fightEx != null) { this.fightEx = (UnitFightExData)mData.fightEx.clone(); } else { this.fightEx = null; } if (mData.ai != null) { this.ai = (UnitAIData)mData.ai.clone(); } else { this.ai = null; } if (mData.func != null) { this.func = (UnitFuncData)mData.func.clone(); } else { this.func = null; } }
void Awake() { movementBehaviour = GetComponent <UnitMovementBehaviour>(); unitData = GetComponent <UnitData>(); }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { UnitData mData = (UnitData)data; if (this.instanceID != mData.instanceID) { return(false); } if (mData.identity != null) { if (this.identity == null) { return(false); } if (!this.identity.dataEquals(mData.identity)) { return(false); } } else { if (this.identity != null) { return(false); } } if (mData.normal != null) { if (this.normal == null) { return(false); } if (!this.normal.dataEquals(mData.normal)) { return(false); } } else { if (this.normal != null) { return(false); } } if (mData.pos != null) { if (this.pos == null) { return(false); } if (!this.pos.dataEquals(mData.pos)) { return(false); } } else { if (this.pos != null) { return(false); } } if (mData.avatar != null) { if (this.avatar == null) { return(false); } if (!this.avatar.dataEquals(mData.avatar)) { return(false); } } else { if (this.avatar != null) { return(false); } } if (mData.move != null) { if (this.move == null) { return(false); } if (!this.move.dataEquals(mData.move)) { return(false); } } else { if (this.move != null) { return(false); } } if (mData.fight != null) { if (this.fight == null) { return(false); } if (!this.fight.dataEquals(mData.fight)) { return(false); } } else { if (this.fight != null) { return(false); } } if (mData.fightEx != null) { if (this.fightEx == null) { return(false); } if (!this.fightEx.dataEquals(mData.fightEx)) { return(false); } } else { if (this.fightEx != null) { return(false); } } if (mData.ai != null) { if (this.ai == null) { return(false); } if (!this.ai.dataEquals(mData.ai)) { return(false); } } else { if (this.ai != null) { return(false); } } if (mData.func != null) { if (this.func == null) { return(false); } if (!this.func.dataEquals(mData.func)) { return(false); } } else { if (this.func != null) { return(false); } } return(true); }
public static bool IsItem(this UnitData unitData) => unitData.HeroLevel == 0;
//public static UnitData From( UnitInitProps teamProps ) { // return new UnitData(); //} public static UnitInitProps From( UnitData unitData ) { return new UnitInitProps(); }
public UnitOption(UnitData unit) { data = unit; }
public BannerUnit(UnitData data) : base(data) { }
// Use this for initialization void Start() { singleton = this; }
public void Deserialize(Json_Friend json) { if (json == null) { throw new InvalidJSONException(); } this.UID = json.uid; this.FUID = json.fuid; this.PlayerName = json.name; this.PlayerLevel = json.lv; this.LastLogin = json.lastlogin; this.CreatedAt = json.created_at; this.IsFavorite = json.is_favorite != 0; this.SelectAward = json.award; this.Wish = json.wish; this.WishStatus = json.status; this.MultiPush = json.is_multi_push == 1; this.MultiComment = json.multi_comment; if (json.unit != null) { this.UnitID = json.unit.iname; this.UnitLevel = json.unit.lv; this.UnitRarity = json.unit.rare; UnitData unitData = new UnitData(); unitData.Deserialize(json.unit); this.Unit = unitData; } string type = json.type; if (type != null) { // ISSUE: reference to a compiler-generated field if (FriendData.\u003C\u003Ef__switch\u0024mapC == null) { // ISSUE: reference to a compiler-generated field FriendData.\u003C\u003Ef__switch\u0024mapC = new Dictionary <string, int>(3) { { "friend", 0 }, { "follow", 1 }, { "follower", 2 } }; } int num; // ISSUE: reference to a compiler-generated field if (FriendData.\u003C\u003Ef__switch\u0024mapC.TryGetValue(type, out num)) { switch (num) { case 0: this.State = FriendStates.Friend; return; case 1: this.State = FriendStates.Follow; return; case 2: this.State = FriendStates.Follwer; return; } } } this.State = FriendStates.None; }
/** 构造角色数据(客户端场景用) */ public virtual void makeCharacterData(UnitData data) { }
/** 构造预进入位置(客户端场景用) */ public virtual void makeScenePosData(UnitData data) { }
public UnitObject( GameObject _GameObject , UnitData _UnitData ) : base(_GameObject) { m_UnitData = _UnitData ; }
private void Refresh() { if (Object.op_Equality((Object)this.UnitTemplate, (Object)null)) { return; } List <UnitData> units = MonoSingleton <GameManager> .Instance.Player.Units; for (int index = 0; index < this.mUnits.Count; ++index) { this.mUnits[index].get_gameObject().SetActive(false); } ShopItem data1 = MonoSingleton <GameManager> .Instance.Player.GetShopData(GlobalVars.ShopType).items[GlobalVars.ShopBuyIndex]; bool flag1 = !data1.IsNotLimited || data1.saleType == ESaleType.Coin_P; if (Object.op_Inequality((Object)this.limited_item, (Object)null)) { this.limited_item.SetActive(flag1); } if (Object.op_Inequality((Object)this.no_limited_item, (Object)null)) { this.no_limited_item.SetActive(!flag1); } if (Object.op_Inequality((Object)this.Sold, (Object)null)) { this.Sold.SetActive(!data1.IsNotLimited); } if (Object.op_Inequality((Object)this.SoldNum, (Object)null)) { this.SoldNum.set_text(data1.remaining_num.ToString()); } ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data1.iname); if (Object.op_Inequality((Object)this.EnableEquipUnitWindow, (Object)null)) { this.EnableEquipUnitWindow.get_gameObject().SetActive(false); int index1 = 0; for (int index2 = 0; index2 < units.Count; ++index2) { UnitData data2 = units[index2]; bool flag2 = false; for (int index3 = 0; index3 < data2.Jobs.Length; ++index3) { JobData job = data2.Jobs[index3]; if (job.IsActivated) { int equipSlotByItemId = job.FindEquipSlotByItemID(data1.iname); if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId)) { flag2 = true; break; } } } if (flag2) { if (index1 >= this.mUnits.Count) { this.UnitTemplate.SetActive(true); GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitTemplate); gameObject.get_transform().SetParent((Transform)this.UnitLayoutParent, false); this.mUnits.Add(gameObject); this.UnitTemplate.SetActive(false); } GameObject gameObject1 = this.mUnits[index1].get_gameObject(); DataSource.Bind <UnitData>(gameObject1, data2); gameObject1.SetActive(true); this.EnableEquipUnitWindow.get_gameObject().SetActive(true); ++index1; } } } DataSource.Bind <ShopItem>(((Component)this).get_gameObject(), data1); if (data1.IsArtifact) { DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname)); } else { DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId); DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname)); } GameParameter.UpdateAll(((Component)this).get_gameObject()); }
public void startBreak(UnitData unitData) { }
void showKnownAttacks(UnitData unit) { if (atkDataList != null && atkDataList.attackList != null && atkDataList.attackList.Count > 0) { foreach (string x in unit.attacksData.ToList<String>()) { AttackData knownAtk = atkDataList.findByID(x); if (knownAtk != null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(knownAtk.aName); EditorGUILayout.TextField("Pattern: " + knownAtk.pattern, GUILayout.ExpandWidth(false)); EditorGUILayout.TextField("Damage: " + knownAtk.expectedMin + " - " + knownAtk.expectedMax, GUILayout.ExpandWidth(false)); EditorGUILayout.TextField("Range: " + knownAtk.range, GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); } } } }
private float m_CreatSelfPercentage = 0.8f ; // 重生的機率. #endregion Fields #region Methods protected void CheckCreateSelf( UnitData _unitData ) { if( _unitData.m_UnitState.state == (int)UnitState.Dead ) { int randomvalue = Random.Range( 0 , 100 ) ; if( randomvalue < m_CreatSelfPercentage * 100 ) { // ex. m_CreatSelfPercentage = 90 // 0~90 < 90 : create // 91~100 > 90 : not create CreateSelf() ; } } }
public static bool IsRandomItem(this UnitData unitData) => unitData.TypeId == RandomItemTypeId;
public static bool IsRandomUnit(this UnitData unitData) => unitData.TypeId == RandomUnitTypeId;
public static bool IsRandomBuilding(this UnitData unitData) => unitData.TypeId == RandomBuildingTypeId;
public static bool IsPlayerStartLocation(this UnitData unitData) => unitData.TypeId == PlayerStartLocationTypeId;
//CALL THIS FUNCTION TO CREATE A UNIT FROM DATA //MEANT FOR THE CARDS TO CALL public override void init(UnitData uData) { base.init(uData); }
/// <summary> /// </summary> /// <param name="unit"></param> /// <returns></returns> public static bool IsInBackswingtime(this Unit unit) { return(UnitData.IsInBackswingtime(unit)); }
public static bool IsGoldMine(this UnitData unitData) => unitData.TypeId == GoldMineTypeId;
/* 船隻的加減速 # 使用上下控制,檢查加減速按鈕 CheckSpeed() # 函式 ConfirmTutorialSpeed() 中,呼叫教學事件 TutorialEvent 來關閉加減速教學 # 取得 船隻資訊 脈衝速度比例 的標準資料 # 依照FPS計算 目前的脈衝速度比例 */ public void CheckSpeed( UnitData _UnitData , float _UpDown ) { if( m_LastUpDown != _UpDown ) SystemLogManager.AddLog( SystemLogManager.SysLogType.Control , "UpDown:" + _UpDown.ToString() ) ; // check ever press up and down for tutorial event if( 0.0f != _UpDown ) { this.ConfirmTutorialSpeed() ; } _UnitData.AdjustImpulseEngineRatio( _UpDown * Time.deltaTime ) ; m_LastUpDown = _UpDown ; }
private string FindMostCloestWeaponComponent( UnitData _unitData , UnitWeaponSystem _weaponSys , NamedObject _possibleUnit , List<string> _possibleWeaponList , ref Dictionary<string , SelectInformation> _fireList ) { string ret = "" ; Dictionary<string,float> angleMap = new Dictionary<string, float>() ; foreach( string weaponComponentName in _possibleWeaponList ) { // Debug.Log( "weaponComponentName=" + weaponComponentName ) ; if( false == _weaponSys.m_WeaponDataMap.ContainsKey( weaponComponentName ) ) { continue ; } // no trackor beam if( -1 != weaponComponentName.IndexOf( ConstName.UnitDataComponentWeaponTrackorBeamPrefix ) ) { continue ; } if( true == _fireList.ContainsKey( weaponComponentName ) ) { // 如果已經用掉了就跳過不作 continue ; } if( 0 != ( _weaponSys.FindAbleWeaponComponent( weaponComponentName , _possibleUnit.Obj ) ).Length ) { WeaponDataSet weapenDataSet = _weaponSys.m_WeaponDataMap[ weaponComponentName ] ; Vector3 toTargetVec = _possibleUnit.Obj.transform.position - this.gameObject.transform.position ; Vector3 toComponentVec = weapenDataSet.Component3DObject.transform.position - this.gameObject.transform.position ; float angle = Vector3.Angle( toComponentVec , toTargetVec ) ; angleMap[ weaponComponentName ] = angle ; // Debug.Log( "toComponentVec=" + toComponentVec ) ; // Debug.Log( "toTargetVec=" + toTargetVec ) ; // Debug.Log( "angleMap[ weaponComponentName ]=" + angle ) ; } } // 尋找angle值最小的 float angleMin = 361.0f ; Dictionary<string,float>.Enumerator e = angleMap.GetEnumerator() ; while( e.MoveNext() ) { if( e.Current.Value < angleMin ) { angleMin = e.Current.Value ; ret = e.Current.Key ; } } // Debug.Log( "FindMostCloestWeaponComponent() ret=" + ret ) ; return ret ; }
private void UpdateBadgeAlternate() { List <GameObject> gameObjectList1 = new List <GameObject>(); List <GameObject> gameObjectList2 = new List <GameObject>(); UnitData dataOfClass1 = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null); if (dataOfClass1 != null) { if (Object.op_Inequality((Object)this.Badge, (Object)null)) { if (dataOfClass1.BadgeState != (UnitBadgeTypes)0) { gameObjectList1.Add(this.Badge); } else { gameObjectList2.Add(this.Badge); } } if (Object.op_Inequality((Object)this.CharacterQuestBadge, (Object)null)) { if (dataOfClass1.IsOpenCharacterQuest() && dataOfClass1.GetCurrentCharaEpisodeData() != null) { gameObjectList1.Add(this.CharacterQuestBadge); } else { gameObjectList2.Add(this.CharacterQuestBadge); } } if (Object.op_Inequality((Object)this.FavoriteBadge, (Object)null)) { if (dataOfClass1.IsFavorite) { gameObjectList1.Add(this.FavoriteBadge); } else { gameObjectList2.Add(this.FavoriteBadge); } } } else { UnitParam dataOfClass2 = DataSource.FindDataOfClass <UnitParam>(((Component)this).get_gameObject(), (UnitParam)null); if (dataOfClass2 != null) { if (Object.op_Inequality((Object)this.Badge, (Object)null)) { if (MonoSingleton <GameManager> .Instance.CheckEnableUnitUnlock(dataOfClass2)) { gameObjectList1.Add(this.Badge); } else { gameObjectList2.Add(this.Badge); } } if (Object.op_Inequality((Object)this.CharacterQuestBadge, (Object)null)) { gameObjectList2.Add(this.CharacterQuestBadge); } if (Object.op_Inequality((Object)this.FavoriteBadge, (Object)null)) { gameObjectList2.Add(this.FavoriteBadge); } } } for (int index = 0; index < gameObjectList2.Count; ++index) { if (Object.op_Inequality((Object)gameObjectList2[index], (Object)null)) { gameObjectList2[index].SetActive(false); } } this.m_Time += Time.get_deltaTime(); if ((double)this.m_Time > 2.0) { this.m_Time -= 2f; ++this.m_Index; if (this.m_Index >= gameObjectList1.Count) { this.m_Index = 0; } } for (int index = 0; index < gameObjectList1.Count; ++index) { if (Object.op_Inequality((Object)gameObjectList1[index], (Object)null)) { gameObjectList1[index].SetActive(this.m_Index == index); } } }
public void Refresh() { this.mCurrentUnit = this.Unit == null ? MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID) : this.Unit; if (this.mCurrentUnit == null || this.mCurrentUnit.GetAwakeLevelCap() <= this.mCurrentUnit.AwakeLv) { return; } DataSource.Bind <UnitData>(((Component)this).get_gameObject(), this.mCurrentUnit); ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(this.mCurrentUnit.UnitParam.piece); int itemAmount1 = MonoSingleton <GameManager> .Instance.Player.GetItemAmount(this.mCurrentUnit.UnitParam.piece); int awakeNeedPieces = this.mCurrentUnit.GetAwakeNeedPieces(); if (Object.op_Inequality((Object)this.KakuseiButton, (Object)null)) { ((Selectable)this.KakuseiButton).set_interactable(this.mCurrentUnit.CheckUnitAwaking()); } if (Object.op_Inequality((Object)this.KakeraMsg, (Object)null)) { this.KakeraMsg.set_text(string.Format(LocalizedText.Get("sys.CONFIRM_KAKUSEI"), (object)itemParam.name, (object)awakeNeedPieces, (object)itemAmount1)); } int num1 = awakeNeedPieces; int itemAmount2 = MonoSingleton <GameManager> .Instance.Player.GetItemAmount(this.mCurrentUnit.UnitParam.piece); int num2 = itemAmount2 < awakeNeedPieces ? itemAmount2 : awakeNeedPieces; if (Object.op_Inequality((Object)this.KakeraCharaMsg, (Object)null)) { if (num2 > 0) { this.KakeraCharaMsg.set_text(string.Format(LocalizedText.Get("sys.KAKUSEI_KAKERA_CHARA"), (object)itemParam.name, (object)num2, (object)itemAmount2)); ((Component)this.KakeraCharaMsg).get_gameObject().SetActive(true); } else { ((Component)this.KakeraCharaMsg).get_gameObject().SetActive(false); } } int num3 = Mathf.Max(0, num1 - num2); ItemParam elementPieceParam = this.mCurrentUnit.GetElementPieceParam(); int elementPieces = this.mCurrentUnit.GetElementPieces(); int num4 = elementPieces < num3 ? elementPieces : num3; this.mElementKakera = (ItemParam)null; if (Object.op_Inequality((Object)this.KakeraElementMsg, (Object)null) && elementPieceParam != null) { if (num4 > 0) { this.KakeraElementMsg.set_text(string.Format(LocalizedText.Get("sys.KAKUSEI_KAKERA_ELEMENT"), (object)elementPieceParam.name, (object)num4, (object)elementPieces)); ((Component)this.KakeraElementMsg).get_gameObject().SetActive(true); this.mElementKakera = elementPieceParam; } else { ((Component)this.KakeraElementMsg).get_gameObject().SetActive(false); } } int num5 = Mathf.Max(0, num3 - num4); ItemParam commonPieceParam = this.mCurrentUnit.GetCommonPieceParam(); int commonPieces = this.mCurrentUnit.GetCommonPieces(); int num6 = commonPieces < num5 ? commonPieces : num5; this.mCommonKakera = (ItemParam)null; if (Object.op_Inequality((Object)this.KakeraCommonMsg, (Object)null) && commonPieceParam != null) { if (num6 > 0) { this.KakeraCommonMsg.set_text(string.Format(LocalizedText.Get("sys.KAKUSEI_KAKERA_COMMON"), (object)commonPieceParam.name, (object)num6, (object)commonPieces)); ((Component)this.KakeraCommonMsg).get_gameObject().SetActive(true); this.mCommonKakera = commonPieceParam; } else { ((Component)this.KakeraCommonMsg).get_gameObject().SetActive(false); } } Mathf.Max(0, num5 - num6); if (Object.op_Inequality((Object)this.JobUnlock, (Object)null)) { bool flag = false; if (this.UnlockJobParam != null) { DataSource.Bind <JobParam>(this.JobUnlock, this.UnlockJobParam); flag = true; } this.JobUnlock.SetActive(flag); } GameParameter.UpdateAll(((Component)this).get_gameObject()); }
private void Refresh() { if (this.mPlayer == null) { return; } GlobalVars.SelectedFriendID = this.mPlayer.fuid; if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UserName, (UnityEngine.Object)null)) { this.UserName.set_text(this.mPlayer.name); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.LastLogin, (UnityEngine.Object)null)) { TimeSpan timeSpan = TimeManager.ServerTime - GameUtility.UnixtimeToLocalTime(this.mPlayer.lastlogin); int days = timeSpan.Days; int hours = timeSpan.Hours; int minutes = timeSpan.Minutes; if (days > 0) { this.LastLogin.set_text(LocalizedText.Get("sys.LASTLOGIN_DAY", new object[1] { (object)days.ToString() })); } else if (hours > 0) { this.LastLogin.set_text(LocalizedText.Get("sys.LASTLOGIN_HOUR", new object[1] { (object)hours.ToString() })); } else if (minutes > 0) { this.LastLogin.set_text(LocalizedText.Get("sys.LASTLOGIN_MINUTE", new object[1] { (object)minutes.ToString() })); } else { this.LastLogin.set_text(LocalizedText.Get("sys.CHAT_POSTAT_NOW")); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UserLv, (UnityEngine.Object)null)) { this.UserLv.text = this.mPlayer.lv.ToString(); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Add, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Remove, (UnityEngine.Object)null)) { if (FlowNode_Variable.Get("IsBlackList").Contains("1")) { this.Remove.SetActive(true); this.Add.SetActive(false); } else { this.Remove.SetActive(false); this.Add.SetActive(true); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendAdd, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendRemove, (UnityEngine.Object)null)) { this.FriendRemove.SetActive((int)this.mPlayer.is_friend != 0); this.FriendAdd.SetActive((int)this.mPlayer.is_friend == 0); Button component = (Button)this.FriendRemove.GetComponent <Button>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null)) { ((Selectable)component).set_interactable(!this.mPlayer.IsFavorite); } } UnitData unit = this.mPlayer.unit; if (unit != null) { DataSource.Bind <UnitData>(((Component)this).get_gameObject(), unit); } if (this.mPlayer != null) { DataSource.Bind <ChatPlayerData>(((Component)this).get_gameObject(), this.mPlayer); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Award, (UnityEngine.Object)null)) { this.Award.SetActive(true); } } this.FriendAdd.SetActive(!this.mPlayer.IsFriend); this.FriendRemove.SetActive(this.mPlayer.IsFriend); GameParameter.UpdateAll(((Component)this).get_gameObject()); }
// 取得必要資訊 protected void RetrieveData( UnitData _unitData ) { m_RaceName = _unitData.m_RaceName ; m_SideName = _unitData.m_SideName ; m_SelfDataTemplateName = _unitData.m_UnitDataTemplateName ; m_SelfPrefabTemplateName = _unitData.m_PrefabTemplateName ; m_SelfSupplementalVec = _unitData.m_SupplementalVec ; m_SelfUnitName = this.gameObject.name ; // 檢查是否有必要產生子代prefab資源 CheckIterate() ; }
public AbilityEvent(BitReader bitReader, Replay replay, Player player, AbilityData abilityData, UnitData unitData) { uint flags; // 1.3.3 patch notes: // - Fixed an issue where the APM statistic could be artificially increased. // This adds the "failed" flag, which is triggered usually by holding down a // hotkey, leading to key repeat spamming the event throughout a single tick. if (replay.ReplayBuild < 18574) // < 1.3.3 { flags = bitReader.Read(17); } else if (replay.ReplayBuild < 22612) // < 1.5.0 { flags = bitReader.Read(18); } else { flags = bitReader.Read(20); } Queued = (flags & 2) != 0; RightClick = (flags & 8) != 0; WireframeClick = (flags & 0x20) != 0; ToggleAbility = (flags & 0x40) != 0; EnableAutoCast = (flags & 0x80) != 0; AbilityUsed = (flags & 0x100) != 0; WireframeUnload = (flags & 0x200) != 0; WireframeCancel = (flags & 0x400) != 0; MinimapClick = (flags & 0x10000) != 0; AbilityFailed = (flags & 0x20000) != 0; // flags & 0xf815 -> Debug for unknown flags // Never found any across all test data. DefaultAbility = (bitReader.Read(1) == 0); DefaultActor = true; if (!DefaultAbility) { AbilityType = abilityData.GetAbilityType( (int)bitReader.Read(16), (int)bitReader.Read(5)); DefaultActor = (bitReader.Read(1) == 0); if (!DefaultActor) { // I'm thinking this would be an array type... but I can't // find anything that causes this bit to be set. throw new InvalidOperationException("Unsupported: non-default actor"); } } if (DefaultActor) { // Deep copy the current wireframe as the actor list // ----- // If a user wants to deal with subgroups to get a more // concise actor list, the data is all here. We're not // going to bother, though, because there are several // exceptions to account for in determining event actors. Actors = new List <Unit>(player.Wireframe.Count); foreach (var unit in player.Wireframe) { Actors.Add(new Unit(unit)); } } var targetType = bitReader.Read(2); if (targetType == 1) // Location target { var targetX = bitReader.Read(20); var targetY = bitReader.Read(20); var targetZ = bitReader.Read(32); TargetLocation = Location.FromEventFormat(targetX, targetY, targetZ); } else if (targetType == 2) // Unit + Location target { TargetFlags = (int)bitReader.Read(8); WireframeIndex = (int)bitReader.Read(8); var unitId = (int)bitReader.Read(32); var unit = replay.GetUnitById(unitId); var unitTypeId = (int)bitReader.Read(16); if (unit == null) { var unitType = unitData.GetUnitType(unitTypeId); unit = new Unit(unitId, unitType); unit.typeId = unitTypeId; replay.GameUnits.Add(unitId, unit); } TargetUnit = unit; var targetHasPlayer = bitReader.Read(1) == 1; if (targetHasPlayer) { TargetPlayer = (int)bitReader.Read(4); } // 1.4.0 -- Don't really know what this was meant to fix if (replay.ReplayBuild >= 19595) { var targetHasTeam = bitReader.Read(1) == 1; if (targetHasTeam) { TargetTeam = (int)bitReader.Read(4); } } var targetX = bitReader.Read(20); var targetY = bitReader.Read(20); var targetZ = bitReader.Read(32); TargetLocation = Location.FromEventFormat(targetX, targetY, targetZ); } else if (targetType == 3) // Unit target { var id = bitReader.Read(32); // Again, if the user wants to determine exactly which // queue item is canceled in the case of a queue cancel // event (the most common case of this target specifier's // occurence), they can; however, it requires an additional // data structure that I don't want to bother with; however, // all the underlying data is available in the events list. TargetId = id; } var lastBit = bitReader.Read(1); // Should be 0; if not, misalignment is likely if (!AbilityFailed) { if (RightClick) { this.EventType = GameEventType.RightClick; } else { this.EventType = EventData.GetInstance().GetEventType(this.AbilityType); } } else { this.EventType = GameEventType.Inactive; } }
private bool TryFireWeaponInMultiAttackMode( UnitData _unitData , UnitSensorSystem _sensorSys , UnitWeaponSystem _weaponSys , UnitSelectionSystem _selectSys , ref Dictionary<string , SelectInformation > _fireList ) { bool ret = false ; // 取得最大可能的瞄準框 int maxSelectionNum = _selectSys.m_MaxSelectionNum ; int selectionIndexNow = 0 ; string [] selectionKeyArray = new string[ _selectSys.m_Selections.Count ] ; _selectSys.m_Selections.Keys.CopyTo( selectionKeyArray , 0 ) ; // 取得最大的武器清單,並依照距離來排序 List<string> possibleWeaponList = RetrievePossibleWeaponListInOrder( _unitData , _weaponSys ) ; // 取得所有的可能敵人,並依照距離來排序 List<NamedObject> possibleUnits = RetrievePossibleUnitInOrder( _sensorSys ); // 目標是讓所有的武器都分別對上不同的敵人.然後設定好所有的瞄準框.最後全部開火. foreach( NamedObject possibleUnit in possibleUnits ) { // Debug.Log( "possibleUnit=" + possibleUnit.Name ) ; // 假如瞄準框已經用盡,離開 if( selectionIndexNow == maxSelectionNum - 1 ) break ; // 每一個單位,找到可以發射的武器,而且最接近中線的武器 string weaponComponentName = FindMostCloestWeaponComponent( _unitData , _weaponSys , possibleUnit , possibleWeaponList , ref _fireList ) ; // Debug.Log( "weaponComponentName=" + weaponComponentName ) ; if( 0 == weaponComponentName.Length ) continue ; // 指定瞄準框的資訊 string key = selectionKeyArray[ selectionIndexNow ] ; _selectSys.m_Selections[ key ].TargetUnitName = possibleUnit.Name ; _selectSys.m_Selections[ key ].TargetUnitObject = possibleUnit.Obj ; // Debug.Log( "_selectSys.m_Selections " + key + " " + possibleUnit.Name ) ; _fireList[ weaponComponentName ] = _selectSys.m_Selections[ key ] ; ++selectionIndexNow ; ret = true ; } // 針對每個瞄準框,發射指定的武器 return ret ; }
private void addUnit(UnitData unit) { this.Units.Add(unit); }
/* h3. 船隻的轉向 # 取得控制左右轉的按鈕 檢查轉向 CheckTurn() # 在函式 ConfirmTutorialTurn() 中,呼叫教學事件 TutorialEvent 來關閉轉向教學 # 如果有啟動自動駕駛(滑鼠點選移動),則不因為沒按鈕而停止轉向,如有按鈕則停止自動駕駛 # 取得 船隻資訊 轉向速度比例 # 依照FPS計算 轉向速度比例的調整值 */ public void CheckTurn( UnitData _UnitData , float _LeftRight ) { if( _LeftRight != m_LastLeftRight ) SystemLogManager.AddLog( SystemLogManager.SysLogType.Control , "LeftRight:" + _LeftRight ) ; // check ever press left and right if( 0.0f != _LeftRight ) { this.ConfirmTutorialTurn() ; } string IMPULSE_ENGINE_ANGULAR_RATIO = ConstName.UnitDataComponentImpulseEngineAngularRatio ; if( true == _UnitData.standardParameters.ContainsKey( IMPULSE_ENGINE_ANGULAR_RATIO ) ) { StandardParameter pulseEngineAngularRatio = _UnitData.standardParameters[ IMPULSE_ENGINE_ANGULAR_RATIO ] ; // check auto pilot bool IsInAutoPilot = false ; UnitGoToPoint gotoPoint = this.gameObject.GetComponent<UnitGoToPoint>() ; if( null != gotoPoint && true == gotoPoint.IsActiveAutoPilot() ) { // do not check clear of angular ratio IsInAutoPilot = true ; } if( 0.5f > _LeftRight && -0.5f < _LeftRight ) { if( false == IsInAutoPilot ) { pulseEngineAngularRatio.now = 0 ;// sudden stop under 0.5 } } else { // check auto pilot if( true == IsInAutoPilot ) { // stop autopilot gotoPoint.Stop() ; } pulseEngineAngularRatio.now += ( _LeftRight * Time.deltaTime ) ; } } m_LastLeftRight = _LeftRight ; }
private void removeUnit(UnitData unit) { this.Units.Remove(unit); }
// 取得最大的武器清單,並依照排序 private List<string> RetrievePossibleWeaponListInOrder( UnitData _unitData , UnitWeaponSystem _weaponSys ) { List<string> ret = new List<string>() ; List<string> allWeapens = _unitData.GetAllWeaponComponentNameVec() ; List<string> realWeapons = new List<string>() ; // 剔除trackor beam foreach( string weapon in allWeapens ) { if( -1 == weapon.IndexOf( ConstName.UnitDataComponentWeaponTrackorBeamPrefix ) ) { // no trackor beam realWeapons.Add( weapon ) ; } } while( realWeapons.Count > 0 ) { // 找最遠的 float maxRange = -1 ; string maxRangeString = "" ; foreach( string weapon in realWeapons ) { float rangeThis = _unitData.componentMap[ weapon ].m_WeaponParam.m_Range ; if( rangeThis > maxRange ) { maxRange = rangeThis ; maxRangeString = weapon ; } } realWeapons.Remove( maxRangeString ) ; ret.Add( maxRangeString ) ; } return ret ; }
public bool Use(UnitData ud) { switch (ItemType) { case ItemType.Special: AlertManager.Instance.AddGameLog("이 아이템은 사용하는 것이 아니다."); return(false); case ItemType.HealPotion: if (ud.HpRatio == 1f) { AlertManager.Instance.AddGameLog( "Hp가 이미 가득 차있다."); return(false); } else { if (ud.Hp == 0) { return(false); } AlertManager.Instance.AddGameLog( "Hp회복 포션으로 " + ItemPower.ToString() + "회복했다."); ud.Hp += Mathf.RoundToInt(ItemPower); ItemAmount -= 1; return(true); } case ItemType.HealMpPotion: if (ud.MpRatio == 1f) { AlertManager.Instance.AddGameLog( "Mp가 이미 가득 차있다."); return(false); } else { AlertManager.Instance.AddGameLog( "Mp회복 포션으로 " + ItemPower.ToString() + "회복했다."); ud.Mp += Mathf.RoundToInt(ItemPower); ItemAmount -= 1; return(true); } case ItemType.FireStatePotion: if (ud.RemoveBuffType(AttackType.Fire) == true) { AlertManager.Instance.AddGameLog( "포션으로 화상을 치유했다." ); ItemAmount -= 1; return(true); } else { AlertManager.Instance.AddGameLog( "해당 상태이상에 걸리지 않았다." ); return(false); } case ItemType.IceStatePotion: if (ud.RemoveBuffType(AttackType.Ice) == true) { AlertManager.Instance.AddGameLog( "포션으로 냉기를 치유했다." ); ItemAmount -= 1; return(true); } else { AlertManager.Instance.AddGameLog( "해당 상태이상에 걸리지 않았다." ); return(false); } case ItemType.PoisonStatePotion: if (ud.RemoveBuffType(AttackType.Poison) == true) { AlertManager.Instance.AddGameLog( "포션으로 독을 치유했다." ); ItemAmount -= 1; return(true); } else { AlertManager.Instance.AddGameLog( "해당 상태이상에 걸리지 않았다." ); return(false); } case ItemType.SpeedBuffPotion: //TODO 구현 버프포션 AlertManager.Instance.AddGameLog( "몸이 더 가벼워졌다" ); var buff = new Buff(); buff.SetBuffIcon(BuffIcon.DashPotionIcon); buff.BuffName = "신속"; buff.BuffDuration = 30f; buff.BuffPower = ItemPower; buff.BuffType = BuffType.Speed; buff.BuffResistType = AttackType.None; ud.Buffs.Add(buff); ItemAmount -= 1; return(false); } return(false); }
public override void Clear() { base.Clear() ; m_UnitData = null ; }
protected void OnClickedNum(Button obj) { obj.gameObject.GetComponent <Outline>().enabled = true; CalcUnit calcUnit = new CalcUnit(); calcUnit.unitType = CalcUnitType.Card; calcUnit.unitData = new UnitData(); calcUnit.unitData.btn = obj; switch (obj.name) { //poker case "poker_topleft": UnitData.Data(calcUnit.unitData).pointUp = topLeftNum; UnitData.Data(calcUnit.unitData).resultBtn = btnResultTopLeft; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; case "poker_topright": UnitData.Data(calcUnit.unitData).pointUp = topRightNum; UnitData.Data(calcUnit.unitData).resultBtn = btnResultTopRight; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; case "poker_bottomleft": UnitData.Data(calcUnit.unitData).pointUp = bottomLeftNum; UnitData.Data(calcUnit.unitData).resultBtn = btnResultBottomLeft; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; case "poker_bottomright": UnitData.Data(calcUnit.unitData).pointUp = bottomRightNum; UnitData.Data(calcUnit.unitData).resultBtn = btnResultBottomRight; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; //result case "result_topleft": if (int.TryParse(obj.GetComponentInChildren <Text>().text, out UnitData.Data(calcUnit.unitData).pointUp)) { UnitData.Data(calcUnit.unitData).pointDown = 1; } else { string[] s = obj.GetComponentInChildren <Text>().text.Split('/'); UnitData.Data(calcUnit.unitData).pointUp = int.Parse(s[0]); UnitData.Data(calcUnit.unitData).pointDown = int.Parse(s[1]); } UnitData.Data(calcUnit.unitData).resultBtn = btnResultTopLeft; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; case "result_topright": if (int.TryParse(obj.GetComponentInChildren <Text>().text, out UnitData.Data(calcUnit.unitData).pointUp)) { UnitData.Data(calcUnit.unitData).pointDown = 1; } else { string[] s = obj.GetComponentInChildren <Text>().text.Split('/'); UnitData.Data(calcUnit.unitData).pointUp = int.Parse(s[0]); UnitData.Data(calcUnit.unitData).pointDown = int.Parse(s[1]); } UnitData.Data(calcUnit.unitData).resultBtn = btnResultTopRight; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; case "result_bottomleft": if (int.TryParse(obj.GetComponentInChildren <Text>().text, out UnitData.Data(calcUnit.unitData).pointUp)) { UnitData.Data(calcUnit.unitData).pointDown = 1; } else { string[] s = obj.GetComponentInChildren <Text>().text.Split('/'); UnitData.Data(calcUnit.unitData).pointUp = int.Parse(s[0]); UnitData.Data(calcUnit.unitData).pointDown = int.Parse(s[1]); } UnitData.Data(calcUnit.unitData).resultBtn = btnResultBottomLeft; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; case "result_bottomright": if (int.TryParse(obj.GetComponentInChildren <Text>().text, out UnitData.Data(calcUnit.unitData).pointUp)) { UnitData.Data(calcUnit.unitData).pointDown = 1; } else { string[] s = obj.GetComponentInChildren <Text>().text.Split('/'); UnitData.Data(calcUnit.unitData).pointUp = int.Parse(s[0]); UnitData.Data(calcUnit.unitData).pointDown = int.Parse(s[1]); } UnitData.Data(calcUnit.unitData).resultBtn = btnResultBottomRight; GlobalDataManager.GetInstance().cardModel.AddCalcUnit(calcUnit); break; } }
public UnitObject( UnitObject _src ) : base(_src) { m_UnitData = _src.m_UnitData ; }
public static string GetVariableName(this UnitData unitData) { return($"gg_unit_{unitData.TypeId.ToRawcode()}_{unitData.CreationNumber:D4}"); }
public void Copy(UnitData _InUnitData) { m_HP.Set(_InUnitData.m_HP); m_ATK.Set(_InUnitData.m_ATK); m_DEF.Set(_InUnitData.m_DEF); }
public static string GetDropItemsFunctionName(this UnitData unitData, int id) { return($"Unit{id:D6}_DropItems"); }
/************************************/ //TYPE DEPENDANT SHOWING /************************************/ /*****UNITS*********************************/ void showUnitCardInfo() { //Filter the desired creature type List<UnitData> unitsInList = new List<UnitData>(); List<String> unitNames = new List<String>(); foreach(UnitData x in unitDataList.unitList.ToList<UnitData>()) { if(x.uType == filterUnit) { unitsInList.Add(x); unitNames.Add(x.uName); } } if(GUILayout.Button("Unit List")) { unitListWindow = (UnitListWindow)EditorWindow.GetWindow(typeof(UnitListWindow)); } currentUnit = unitDataList.findByID(cardDataList.cardList[toggledIndex].linkedTo); GUILayout.Space(10); //Associate the correct UnitType, possibly load into current object field if (currentUnit != null) { if (currentUnit.isHero) EditorGUILayout.LabelField("Hero Unit"); EditorGUILayout.LabelField(currentUnit.uName, EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.LabelField("Stats"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("HP"); EditorGUILayout.TextField(currentUnit.maxHp.ToString()); //EditorGUILayout.EndHorizontal(); //EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Speed "); EditorGUILayout.TextField(currentUnit.maxSpeed.ToString()); EditorGUILayout.EndHorizontal(); if (currentUnit.isHero) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Impulse "); EditorGUILayout.TextField(currentUnit.impulse.ToString()); //EditorGUILayout.EndHorizontal(); //.BeginHorizontal(); EditorGUILayout.LabelField("Memory "); EditorGUILayout.TextField(currentUnit.memory.ToString()); EditorGUILayout.EndHorizontal(); } EditorGUILayout.LabelField("Known Attacks"); showKnownAttacks(currentUnit); } else EditorGUILayout.LabelField("No Unit Linked", EditorStyles.boldLabel); }
// status effect public UnitState(Unit unit) { data = unit.data; currentHealth = unit.health.current; }
public void EditList() { int maxCount = GetSelectWindowCount( "UnitSelectWindow"); unitData = new UnitData[6]; teamA = new UnitData[6]; teamASlot = new UnitSlotData[6,4]; keepData = new UnitData[1]; weaponData = new WeaponData[6]; keepWeaponData = new WeaponData[1]; for ( int i = 0; i < maxCount; i++ ) { string charName = GetCharName ( i ); string weaponName = GetWeaponName ( i ); // ----- weaponData[i] = new WeaponData ( i, weaponName, ( ( i + 1 ) * 2 ) ); GameObject _weaponNameText = GameObject.Find ( "WeaponText_List (" + i + ")" ); _weaponNameText.GetComponent<Text>().text = weaponData[i].weapon_name.ToString(); GameObject _weaponAttackText = GameObject.Find ( "WeaponAttack_Text (" + i + ")" ); _weaponAttackText.GetComponent<Text>().text = weaponData[i].attack.ToString(); for ( int j = 0; j < 4; j++ ) { teamASlot[i,j] = new UnitSlotData ( i, GetWeaponName( j ), ( ( i + 1 ) * 2 ) ); Debug.Log ( j + ": " + teamASlot[i,j] ); } // ----- unitData[i] = new UnitData( ( i ), charName, ( i ) ); teamA[i] = new UnitData( ( i ), charName, ( i ) ); GameObject selWindow = GameObject.Find ( "CharSelect_List (" + i.ToString() + ")" ); selectWindowList.Add( selWindow ); GameObject teamAWindow = GameObject.Find ( "UnitSlot (" + i.ToString() + ")" ); teamAWindowList.Add( teamAWindow ); GameObject teamAPowerText = GameObject.Find ( "PowerInfo_Text (" + i + ")" ); teamAPowerText.GetComponent<Text>().text = ( "合計攻撃力:" + teamA[i].attack.ToString() ); GameObject teamACharText = GameObject.Find ( "TeamACharText_List (" + i + ")" ); teamACharText.GetComponent<Text>().text = GetCharName (i); // 部隊外分 GameObject childSprite = selectWindowList[i].gameObject.transform.FindChild("CharSprite_Panel/CharSprite_List (" + i.ToString() + ")" ).gameObject; childSprite.GetComponent<Image>().sprite = Resources.Load<Sprite> ( "Sprites/Character/MiniChar_" + unitData[i].char_no.ToString() ); GameObject childText = GameObject.Find ( "CharText_List (" + i + ")" ); charName = GetCharName ( unitData[i].char_no ); childText.GetComponent<Text>().text = charName; // 部隊分 GameObject teamASprite = GameObject.Find ("SpriteSlot (" + i.ToString() + ")" ).gameObject; teamASprite.GetComponent<Image>().sprite = Resources.Load<Sprite> ( "Sprites/Character/MiniChar_" + unitData[i].char_no.ToString() ); } }
public UnitState(UnitState state) { data = state.data; currentHealth = state.currentHealth; }