public void OnTouchTarget() { if (_mIsTouchTarget) { return; } _mIsTouchTarget = true; if (!_isHitParticleCreated) { CreateHitParticle(); } // Notify destroy this skill? or change the skill state, and destroy by the skill user in next frame update? // All targets play be attacked effect foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values) { WarshipL target = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID); target.OnBeAttacked(this); } // Call the callback event method _mSkillUser.OnAttackEnd(this); _mSkillState = SkillState.HIT_TARGET; }
public WarshipL CreateWarship(GirlData data, WarshipL.CreateCallback callback) { WarshipL ws = GetWarship(data.roleCardId); if (ws != null) { return(ws); } ws = new WarshipL(data); ws.Initialize(delegate(WarshipL ws1) { _mWarshipList.Add(ws); if (null != callback) { callback(ws); } }); // LocateFleetPosition(); // CalculateFleetRect(); return(ws); }
public bool OnFingerDownEvent(int fingerIndex, Vector2 fingerPos) { _mSelectShip = null; if (m_battleSelectedPrefab != null) { m_battleSelectedPrefab.SetActiveRecursively(false); } GameObject pickObject = SceneQueryUtil.PickObject(fingerPos); if (null == pickObject) { // Clean up Object GUI GUIBattle gui = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattle>(); if (null != gui && gui.IsVisible) { gui.SetShipInfoVisible(false); } return(true); } if (!pickObject.CompareTag(TagMaskDefine.GFAN_FIGHT_WARSHIP)) { // Clean up Object GUI GUIBattle gui = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattle>(); if (null != gui && gui.IsVisible) { gui.SetShipInfoVisible(false); } return(true); } WarshipL pickWarship = Globals.Instance.MPlayerManager.GetWarship(pickObject); if (null == pickWarship) { // Clean up Object GUI GUIBattle gui = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattle>(); if (null != gui && gui.IsVisible) { gui.SetShipInfoVisible(false); } return(true); } _mSelectShip = pickWarship; if (m_battleSelectedPrefab != null) { m_battleSelectedPrefab.SetActiveRecursively(true); } // Display Object GUI Globals.Instance.MGUIManager.CreateWindow <GUIBattle>(delegate(GUIBattle gui) { gui.UpdateData(pickWarship); } ); return(true); }
public NiVose(SkillDataSlot dataSlot, WarshipL skillUser) : base(dataSlot) { _mFireDuration = 0.0f; _mRTTCam = null; _mSkillUser = skillUser; }
/// <summary> /// Starts the nivose track. /// </summary> /// <returns> /// The nivose track. /// </returns> /// <param name='trackName'> /// Track name. /// </param> /// <param name='dataSlot'> /// Data slot. /// </param> public CameraTrack StartNivoseTrack(string trackName, SkillDataSlot dataSlot) { Vector3 tStartPos = Globals.Instance.MPlayerManager.GetWarship(dataSlot._attackerID).U3DGameObject.transform.position; Vector3 tTargetPos = Vector3.zero; foreach (SkillDataSlot.AttackTargetData data in dataSlot._attackTargetDataList.Values) { if (data._isPrimaryTarget) { WarshipL target = Globals.Instance.MPlayerManager.GetWarship(data._targetID); tTargetPos = target.U3DGameObject.transform.position; break; } } CameraTrack track = null; if (!_mCamTrackList.TryGetValue(trackName, out track)) { Object obj = Resources.Load(trackName); GameObject go = GameObject.Instantiate(obj) as GameObject; go.name = trackName; track = go.GetComponent <CameraTrack>() as CameraTrack; _mCamTrackList.Add(trackName, track); } track.RestartNivoseTrack(true, tStartPos, tTargetPos); return(track); }
public Skill CreateSkill(SkillDataSlot skillData, WarshipL skillUser) { Skill skill = null; switch (skillData.MSkillData.BasicData.SkillType) { case ESkillType.SINGLE_NIVOSE: case ESkillType.GROUP_NIVOSE: case ESkillType.GROUP_REPAIR_NIVOSE: { skill = new NiVose(skillData, skillUser); break; } default: { skill = new Skill(skillData); break; } } skill.Initialize(); _skillList.Add(skill); return(skill); }
public virtual void OnWarshipDeath(WarshipL warship) { // List<WarshipL> tmpRemoveWarshipList = new List<WarshipL>(); // foreach (FleetL fleet in _currentFleets.Values) // { // tmpRemoveWarshipList.Clear(); // // foreach (WarshipL ws in fleet._mWarshipList) // { // if (ws == warship) // { // tmpRemoveWarshipList.Add(ws); // break; // } // } // // foreach (WarshipL ws in tmpRemoveWarshipList) // { // fleet._mWarshipList.Remove(ws._warshipID); // } // } if (m_teachOwnShipDownEvent != null) { m_teachOwnShipDownEvent(TeachBattleEvent.e_ownShipDown); m_teachOwnShipDownEvent = null; battleStepDuration = 0.0f; _mDelayTime = DELAY_TIME; } }
private void UpdateBuffData(WarshipL ws) { foreach (Transform tf in _mBuffInfoRoot) { GameObject.Destroy(tf.gameObject); } Dictionary <int, BuffData> dataList = null; if (ws.Property.WarshipIsAttacker) { dataList = GameStatusManager.Instance.MBattleStatus.MBattleResult.AttackerBuffDataList; } else { dataList = GameStatusManager.Instance.MBattleStatus.MBattleResult.AttackedBuffDataList; } if (0 == dataList.Count) { return; } int row = 0; int col = 0; foreach (BuffData data in dataList.Values) { CreateBuffIcon(data, row, col); col++; if (col == BUFF_COUNT_PER_ROW) { row++; col = 0; } } if (GameStatusManager.Instance.MBattleStatus.MBattleResult.BattleType != GameData.BattleGameData.BattleType.PORT_VIE_BATTLE) { return; } // vie inspire buff if (Globals.Instance.MPortVieManager.puVieDiamondInspire > 0) { CreateBuffIcon(EBufferType.BUFFER_INSPIRE, row, col); col++; if (col == BUFF_COUNT_PER_ROW) { row++; col = 0; } } if (Globals.Instance.MPortVieManager.puVieDiamondOrder > 0) { CreateBuffIcon(EBufferType.BUFFER_ORDER, row, col); } }
/// <summary> /// Creates the general avatar. /// </summary> /// <returns> /// The general avatar. /// </returns> /// <param name='shipData'> /// Ship data. /// </param> public EZWarshipHeader CreateGeneralAvatar(WarshipL shipData) { GameObject go = CreateEZ3DItem(WarshipHeaderTP, Vector3.zero); EZWarshipHeader generalAvatar = go.GetComponent <EZWarshipHeader>(); generalAvatar.SetValue(new object[] { shipData }); return(generalAvatar); }
public override void OnWarshipDeath(WarshipL warship) { // if(m_teachOwnShipDownEvent != null ){ // m_teachOwnShipDownEvent(TeachBattleEvent.e_ownShipDown); // m_teachOwnShipDownEvent = null; // // battleStepDuration = 0.0f; // _mDelayTime = DELAY_TIME; // } }
public override void OnBeAttacked(WarshipL warship, Skill skill) { // // tzz added // // for teach first fire in Teach first enter scene // // check TeachFirstEnterGame.cs for detail // if(m_teachFirstFireEvent != null){ // m_teachFirstFireEvent(TeachBattleEvent.e_firstFire); // m_teachFirstFireEvent = null; // // battleStepDuration = 0.0f; // _mDelayTime = DELAY_TIME; // } }
// public WarshipL CreateWarship(GirlData data) // { // WarshipL ws = GetWarship(data.WarShipID); // // if (ws != null) // return ws; // // ws = new WarshipL(data); // ws.Initialize(); // // _mWarshipList.Add(data.WarShipID, ws); // // return ws; // } public void RemoveWarship(WarshipL ws) { _mWarshipList.Remove(ws); if (null != ws) { ws.Release(); } if (_mWarshipList.Count == 0) { _mIsDeath = true; return; } }
public virtual void OnBeAttacked(WarshipL warship, Skill skill) { // tzz added // for teach first fire in Teach first enter scene // check TeachFirstEnterGame.cs for detail if (m_teachFirstFireEvent != null) { m_teachFirstFireEvent(TeachBattleEvent.e_firstFire); m_teachFirstFireEvent = null; battleStepDuration = 0.0f; _mDelayTime = DELAY_TIME; } }
public void UpdateShipInfo(WarshipL ship) { GirlData data = ship.GirlData; if (null == data) { return; } SetShipInfoVisible(true); SetWarshipLife(ship.GirlData.PropertyData.Life, ship.GirlData.PropertyData.MaxLife); SetWarshipDander(ship.GirlData.PropertyData.Power, ship.GirlData.PropertyData.MaxPower); SetSkillInfo(data); }
public WarshipL GetWarship(GameObject go) { WarshipL ws = null; foreach (FleetL fleet in _fleetList.Values) { ws = fleet.GetWarship(go); if (ws != null) { return(ws); } } return(null); }
// An useful global assistant method public WarshipL GetWarship(long warshipID) { WarshipL ws = null; foreach (FleetL fleet in _fleetList.Values) { ws = fleet.GetWarship(warshipID); if (ws != null) { return(ws); } } return(null); }
public void RemoveWarship(WarshipL ws) { _mWarshipList.Remove(ws); if (null != ws) { ws.Release(); } if (_mWarshipList.Count == 0) { _isDeath = true; return; } // LocateFleetPosition(); // CalculateFleetRect(); }
private void UpdateCamera() { if (_mActorFleet == null || _mActorFleet._mWarshipList.Count == 0) { return; } WarshipL warship = _mActorFleet._mWarshipList[0]; Vector3 targetPosition = warship.U3DGameObject.transform.position; Quaternion targetRotation = warship.U3DGameObject.transform.rotation; float zDistance = 300.0f; float height = 288.0f; float moveDamping = 10.0f; float rotationDamping = 1.0f; float xDistance = 0.0f; // Calculate the current rotation angles float wantedRotationAngle = warship.U3DGameObject.transform.rotation.eulerAngles.y; float wantedHeight = targetPosition.y + height; float currentRotationAngle = Globals.Instance.MSceneManager.mMainCamera.transform.eulerAngles.y; float currentHeight = Globals.Instance.MSceneManager.mMainCamera.transform.position.y; // Damp the rotation around the y-axis currentRotationAngle = Mathf.LerpAngle(currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime); // Damp the height currentHeight = Mathf.Lerp(currentHeight, wantedHeight, moveDamping * Time.deltaTime); // Convert the angle into a rotation Quaternion currentRotation = Quaternion.Euler(0, currentRotationAngle, 0); // Set the position of the camera on the x-z plane to: // distance meters behind the target float wantedX = (targetPosition + targetRotation * Vector3.right).x + xDistance; float wantedZ = (targetPosition + targetRotation * Vector3.forward).z - zDistance; Globals.Instance.MSceneManager.mMainCamera.transform.position = new Vector3(wantedX, currentHeight, wantedZ); Globals.Instance.MSceneManager.mMainCamera.transform.LookAt(new Vector3(wantedX, targetPosition.y, targetPosition.z)); _mCurrentCamPos = Globals.Instance.MSceneManager.mMainCamera.transform.position; _mCurrentCamForward = Globals.Instance.MSceneManager.mMainCamera.transform.forward; }
private void Init(UISlider progressBlood, float val, Vector3 position, Vector3 offset) { _bloodStrip = GameObject.Instantiate(progressBlood) as UISlider; _bloodStrip.gameObject.transform.parent = Globals.Instance.M3DItemManager.EZ3DItemParent; _bloodStrip.gameObject.transform.localScale = Vector3.one; // tzz added // for Reinforcements label sign WarshipL warship = Globals.Instance.MPlayerManager.GetWarship(_shipID); if (null != warship) { if (warship.Property.WarshipIsAttacker && warship.Property.WarshipIsNpc) { PackedSprite ps = (PackedSprite)GameObject.Instantiate(Globals.Instance.M3DItemManager.ReinforcementsLabelPrefab); ps.transform.parent = _bloodStrip.gameObject.transform; } } UpdateBloodStripValue(val, position, offset); }
public void UpdateData(WarshipL ship) { // Update buff information _mCurrentWarShip = ship; GirlData data = _mCurrentWarShip.GirlData; if (null == data) { return; } _mShipInfoRoot.gameObject.SetActiveRecursively(true); // SetWarshipName(data.BasicData.Name); SetWarshipLife(data.PropertyData.Life, data.PropertyData.MaxLife); SetWarshipDander(data.PropertyData.Power, data.PropertyData.MaxPower); // Check skill SetSkillInfo(data); UpdateBuffData(ship); }
private void RegisterSubscriber() { // Add EventListener if (null == _mWarshipBeAttacked) { _mWarshipBeAttacked = EventManager.Subscribe(WarshipPublisher.NAME + ":" + WarshipPublisher.EVENT_BE_ATTACKED); _mWarshipBeAttacked.Handler = delegate(object[] args) { WarshipL dShip = (WarshipL)args[0]; Skill dSkill = (Skill)args[1]; // Check if this target value is current select target if (_mCurrentWarShip != dShip) { return; } SetWarshipLife(_mCurrentWarShip.GirlData.PropertyData.Life, _mCurrentWarShip.GirlData.PropertyData.MaxLife); SetWarshipDander(_mCurrentWarShip.GirlData.PropertyData.Power, _mCurrentWarShip.GirlData.PropertyData.MaxPower); }; } if (null == _mWarshiDeath) { _mWarshiDeath = EventManager.Subscribe(WarshipPublisher.NAME + ":" + WarshipPublisher.EVENT_DEATH); _mWarshiDeath.Handler = delegate(object[] args) { WarshipL dShip = (WarshipL)args[0]; if (_mCurrentWarShip != dShip) { return; } SetShipInfoVisible(false); }; } }
public virtual bool OneBattleStep(int step, GameData.BattleGameData.BattleStep stepData) { UnityEngine.Profiling.Profiler.BeginSample("BattleStatus.OneBattleStep"); // Has 3 parts /**Part1: * 1).Trim the basic data of all warships in this step * 2).Calculate the count of a warship is attacked * */ /**Part2: * 1).Simulate the all warships running logic * 2).Display its * */ /**Part3: Implement in OnOneBattleStepEnd() * 1).Trim all warships InitialLife for the next step simulate * */ // Debug.Log("The current stepID is : " + stepData.StepID.ToString()); foreach (GameData.BattleGameData.BattleShip battleShip in stepData.BattleShips) { // // Search the Warship // WarshipL warship = Globals.Instance.MPlayerManager.GetWarship(battleShip.ShipID); // // // Assign the base value // warship.Property.WarshipCurrentLife = battleShip.CurrentLife; // warship.Property.WarshipCurrentPower = (short)battleShip.CurrentPower; // Attack is the separate logic GameData.BattleGameData.AttackState attackState = battleShip.AttackState; if (attackState == GameData.BattleGameData.AttackState.IDLE) { continue; } // Construct a skill or a attackEvent? Include multiple be attacked target foreach (GameData.BattleGameData.AttackedTarget attackedTarget in battleShip.AttackedTargets) { // Stat. the num of be attacked WarshipL targetWarship = Globals.Instance.MPlayerManager.GetWarship(attackedTarget.ShipID); if (null == targetWarship) { Debug.Log("[BattleStatus]: Why the target ship " + attackedTarget.ShipID + " is null?"); continue; } targetWarship._numBeAttacked += 1; } } // Part2 foreach (GameData.BattleGameData.BattleShip battleShip in stepData.BattleShips) { // Search the Warship WarshipL warship = Globals.Instance.MPlayerManager.GetWarship(battleShip.ShipID); if (null == warship) { Debug.Log("[BattleStatus]: Why the ship " + battleShip.ShipID + " is null?"); continue; } // Assign the base value warship.Property.WarshipCurrentLife = battleShip.CurrentLife; warship.Property.WarshipCurrentPower = (short)battleShip.CurrentPower; // tzz added for modify some bug // warship.GirlData.PropertyData.Life = battleShip.CurrentLife; warship.GirlData.PropertyData.Power = battleShip.CurrentPower; Vector3 currentPosition = warship.U3DGameObject.transform.position; Vector3 targetPosition = HelpUtil.GetWarFiledGridPosition(battleShip.CurrentPosition); targetPosition += SceneOffset; // Perform the step logci GameData.BattleGameData.MoveState moveState = battleShip.MoveState; switch (moveState) { case GameData.BattleGameData.MoveState.MOVE: { // move speed warship.MoveTo(targetPosition); // tzz added // for teach first move in Teach first enter scene // check TeachFirstEnterGame.cs for detail //if(m_teachStartMovingEvent != null){ // m_teachStartMovingEvent(TeachBattleEvent.e_startMoving); // m_teachStartMovingEvent = null; // // battleStepDuration = 0.0f; // _mDelayTime = DELAY_TIME; //} break; } case GameData.BattleGameData.MoveState.STOP: { warship.ForceMoveTo(targetPosition); break; } case GameData.BattleGameData.MoveState.SINK: { //warship.ForceSink(); break; } } // Attack is the separate logic GameData.BattleGameData.AttackState attackState = battleShip.AttackState; if (attackState == GameData.BattleGameData.AttackState.IDLE) { continue; } // tzz added for setting buffer of fire if (warship.WarshipHeader != null && battleShip.BattleBuffersList != null) { warship.WarshipHeader.SetBufferStepInterval(battleShip.BattleBuffersList, step); } // Only perform the skill effect, construct the skill data now SkillDataSlot skillData = new SkillDataSlot(battleShip.SkillLogicID, warship._warshipID, (int)attackState); // Construct a skill or a attackEvent? Include multiple be attacked target int targetIndex = 0; foreach (GameData.BattleGameData.AttackedTarget attackedTarget in battleShip.AttackedTargets) { WarshipL targetWarship = Globals.Instance.MPlayerManager.GetWarship(attackedTarget.ShipID); if (null == targetWarship) { Debug.Log("[BattleStatus]: Why the target ship " + attackedTarget.ShipID + " is null?"); continue; } int targetMoveState; GetWarshipMoveStateInStep(attackedTarget.ShipID, stepData, out targetMoveState); SkillDataSlot.AttackTargetData attackTargetData = new SkillDataSlot.AttackTargetData(); attackTargetData._targetID = attackedTarget.ShipID; attackTargetData._moveState = targetMoveState; attackTargetData._beAttackedState = (int)attackedTarget.AttackedState; attackTargetData._beAttackedDamage = attackedTarget.Damage; if (targetIndex == 0) { skillData._primaryTargetID = attackTargetData._targetID; attackTargetData._isPrimaryTarget = true; } else { attackTargetData._isPrimaryTarget = false; } skillData._attackTargetDataList.Add(attackedTarget.ShipID, attackTargetData); // tzz added for general command show if (warship.WarshipHeader != null && warship.WarshipHeader.Avatar != null && !skillData.MSkillData.BasicData.SkillIsNormalAttack && // is NOT normal skill targetIndex == 0) // is first target { BattleGeneralCmd.ShowGeneralCmd(warship.WarshipHeader.Avatar, Globals.Instance.MDataTableManager.GetWordText(skillData.MSkillData.BasicData.SkillWord)); } targetIndex++; } warship.Attack(skillData); } UnityEngine.Profiling.Profiler.EndSample(); return(true); }
public virtual void CreateFlyParticle() { bool isCreate = false; foreach (SkillEffectData.SkillFlyParticleData flyParticleData in _mSkillDataSlot._skillEffectData._skillFlyParticleList) { if (_mCurrentTrackTime >= flyParticleData._delayTime) { // tzz added for null if (_mSkillUser.U3DGameObject == null) { continue; } // Play fly sound if (null != flyParticleData._skillSound) { Debug.Log("_mSkillUser " + _mSkillUser.U3DGameObject.name + "Sound " + flyParticleData._skillSound._soundName); Globals.Instance.MSoundManager.PlaySoundEffect(flyParticleData._skillSound._soundName); } Vector3 startPosition = _mSkillUser.U3DGameObject.transform.position; // Create multiple missile effects foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values) { UnityEngine.Object obj = Resources.Load(flyParticleData._particleName); if (null == obj) { isCreate = true; Debug.Log("[Skill]: Cann't find the fly effect name " + flyParticleData._particleName); continue; } // Calculate the Projectile ParticleEffect information GameObject go = GameObject.Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject; WarshipL target = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID); Vector3 endPosition = target.U3DGameObject.transform.position; float missileHorzSpeed = flyParticleData.speed; float targetHorzSpeed = target.MoveSpeed; if (attackTargetData._moveState == (int)GameData.BattleGameData.MoveState.STOP) { targetHorzSpeed = 0.0f; } MotionTrack motionTrack = null; // Lihaojie 2012.09.26 Add a time track model, solve the problem which caused by the cure skill and damage skill order if (_mSkillDataSlot.IsCureSkill()) { motionTrack = new TimeTrack(GameDefines.BATTLE_STEP_TIME - flyParticleData._delayTime - 0.05f); } else { switch ((EWarshipType)_mSkillUser.Property.WarshipType) { case EWarshipType.CARRIER: { startPosition.y += 50.0f; endPosition.y += 50.0f; // missileHorzSpeed = 150; motionTrack = new AirCraftTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed); break; } case EWarshipType.SUBMARINE: { motionTrack = new LineTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed); break; } case EWarshipType.SURFACE_SHIP: { // Assume the two speed is in x axis float gravityAcceleration = -100.0f; // MotionTrack motionTrack = new ParabolicTrack(startPosition, endPosition, horzSpeed); motionTrack = new ParabolicTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed, gravityAcceleration); break; } } } MissileL missile = new MissileL(go, motionTrack); _mMissileEffectList.Add(missile); _mFlyEffectObjs.Add(go); isCreate = true; _mSkillState = SkillState.FLY; } // End foreach } } _mIsFlyParticleCreated = isCreate; }
public override void CreateFlyParticle() { // tzz modified for enemy NiVose fly particle // // if (!_mSkillUser.Property.WarshipIsAttacker) // { // base.CreateFlyParticle(); // // // tzz modified for creating fly state // // // if(_mIsFlyParticleCreated){ // _mSkillState = SkillState.FLY; // } // return; // } bool isCreate = false; foreach (SkillEffectData.SkillFlyParticleData flyParticleData in _mSkillDataSlot._skillEffectData._skillFlyParticleList) { if (_mCurrentTrackTime >= flyParticleData._delayTime) { if (null != flyParticleData._skillSound) { Globals.Instance.MSoundManager.PlaySoundEffect(flyParticleData._skillSound._soundName); } WarshipL skillUser = Globals.Instance.MPlayerManager.GetWarship(_mSkillDataSlot._attackerID); Vector3 startPosition = skillUser.U3DGameObject.transform.position; // Create multiple missile effects foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values) { string effectName = flyParticleData._particleName; if (_mSkillUser.Property.WarshipIsAttacker) { effectName = flyParticleData._particleName + "_L"; } else { effectName = flyParticleData._particleName + "_R"; } // Calculate the Projectile ParticleEffect information GameObject go = GameObject.Instantiate(Resources.Load(effectName), Vector3.zero, Quaternion.identity) as GameObject; if (null == go) { Debug.Log("The effect resource " + effectName + "is not found"); continue; } WarshipL target = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID); Vector3 endPosition = target.U3DGameObject.transform.position; float missileHorzSpeed = flyParticleData.speed; float targetHorzSpeed = target.MoveSpeed; if (attackTargetData._moveState == (int)GameData.BattleGameData.MoveState.STOP) { targetHorzSpeed = 0.0f; } MotionTrack motionTrack = null; startPosition.y += 50.0f; endPosition.y += 50.0f; // missileHorzSpeed = 150; go.transform.position = startPosition; motionTrack = new AirCraftTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed); MissileL missile = new MissileL(go, motionTrack); _mMissileEffectList.Add(missile); _mFlyEffectObjs.Add(go); isCreate = true; _mSkillState = SkillState.FLY; break; } // End foreach } } _mIsFlyParticleCreated = isCreate; }
protected void CalculateHitParticleType(SkillDamageRange.Rect rect, out EHitParticleType hitType, out Vector3 hitPos) { hitType = EHitParticleType.HIT_PARTICLE_PRIMARY; hitPos = Vector3.zero; // // Left-Bottom // Vector3 leftBottomPos = HelpUtil.GetGridPosition(rect.left, rect.bottom); // // Left-Top // Vector3 leftTopPos = HelpUtil.GetGridPosition(rect.left, rect.top); // // // Right-Bottom // Vector3 rightBottomPos = HelpUtil.GetGridPosition(rect.right, rect.bottom); // // Right-Top // Vector3 rightTopPos = HelpUtil.GetGridPosition(rect.right, rect.top); Rect checkRect = new Rect(); checkRect.xMin = rect.left; checkRect.yMin = rect.bottom; checkRect.xMax = rect.right; checkRect.yMax = rect.top; // Calculate the real damage rect if (_mSkillDataSlot.MSkillData.BasicData.SkillType != ESkillType.GROUP_NIVOSE) { WarshipL target = Globals.Instance.MPlayerManager.GetWarship(_mSkillDataSlot._primaryTargetID); Vector3 attachPosition = target.U3DGameObject.transform.position; checkRect.xMin += attachPosition.x; checkRect.yMin += attachPosition.z; checkRect.xMax += attachPosition.x; checkRect.yMax += attachPosition.z; } // Add the be attacked target effect on the target foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values) { WarshipL target = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID); Vector3 attachPosition = target.U3DGameObject.transform.position; bool isContains = checkRect.Contains(new Vector2(attachPosition.x, attachPosition.z)); if (isContains && attackTargetData._isPrimaryTarget) { hitType = EHitParticleType.HIT_PARTICLE_PRIMARY; hitPos = attachPosition; return; } else if (isContains) { hitType = EHitParticleType.HIT_PARTICLE_ASSISTANT; hitPos = attachPosition; return; } } // End foreach // hitType = EHitParticleType.HIT_PARTICLE_WATER_SURFACE; hitPos.x = checkRect.center.x; hitPos.y = 0.0f; hitPos.z = checkRect.center.y; }
// 2012.04.05 LiHaojie Begin the battle logic public virtual void BeginBattleLogic() { // Recalculate the formation bounds actorFormations.Clear(); enemyFormations.Clear(); FleetL fleet = null; WarshipL warship = null; foreach (GameData.BattleGameData.Fleet fleetData in _battleResult.Fleets) { List <GameData.BattleGameData.Ship> shipDatas = fleetData.Ships; fleet = Globals.Instance.MPlayerManager.CreateFleet(fleetData.FleetID); fleet._isActorFleet = !fleetData.NPCFleet; fleet._isAttachFleet = fleetData.IsAttacker; PlayerData data = null; if (_battleResult.BattleType == GameData.BattleGameData.BattleType.PORT_VIE_BATTLE && Globals.Instance.MPortVieManager.puFlagReverseFleetPosition) { if (fleet._isAttachFleet) { data = Globals.Instance.MGameDataManager.MEnemyData; } else { data = Globals.Instance.MGameDataManager.MActorData; } } else { if (fleet._isAttachFleet) { data = Globals.Instance.MGameDataManager.MActorData; } else { data = Globals.Instance.MGameDataManager.MEnemyData; } } foreach (GameData.BattleGameData.Ship shipData in shipDatas) { GirlData wsData = data.GetGirlData(shipData.ShipID); //tzz added wsData.WarshipGeneralLogicID = shipData.GeneralLogicID; wsData.WarshipGeneralAvatar = shipData.GeneralAvatar; fleet.CreateWarship(wsData, delegate(WarshipL ws) { warship = ws; warship.setBloodDisplay(true); warship._warshipLogicID = shipData.LogicShipID; // warship.U3DGameObject.name = wsData.BasicData.Name; warship.GameObjectTag = TagMaskDefine.GFAN_FIGHT_WARSHIP; // Fleet data warship.Property.WarshipFleetID = fleet._fleetID; warship.Property.WarshipIsAttacker = fleet._isAttachFleet; warship.Property.WarshipIsNpc = shipData.IsNpc; // // A specifical value, use to simulate server running warship._numBeAttacked = 0; Vector3 position = HelpUtil.GetWarFiledGridPosition(shipData.Position); position += SceneOffset; warship.ForceMoveTo(position); // Rotate 180 around y axis if (!fleet._isAttachFleet) { warship.U3DGameObject.transform.rotation = Quaternion.AngleAxis(180, Vector3.up); } }); if (fleet._isAttachFleet) { AddFormationCell(shipData.Position, actorFormations); } else { AddFormationCell(shipData.Position, enemyFormations); } } // If is Npc fleet if (fleetData.NPCFleet == true) { // The enemy fleet information _enemyFleet = fleet; } else { // The actor information _actorFleet = fleet; } _currentFleets.Add(fleet._fleetID, fleet); } //tzz added for store the fov in order restore when Battle end // CustomCameraFormerFov = Globals.Instance.MSceneManager.mMainCamera.fov; Globals.Instance.MSceneManager.mMainCamera.fov = 60; }
// #region CameraControl // public void UpdateCamera() // { // if (_currentFleets.Count < 2) // return; // // // Note: one cell is 100 X 50 units(metres) // // Calculate the distance from actor fleet position to npc enemy fleet // Vector3 actorFleetEndPosition = _actorFleet._theFleetEndPosition; // Vector3 enemyFleetEndPosition = _enemyFleet._theFleetEndPosition; // // // The Range of (battle starting to 16 cell) // float distanceOfFleets = Mathf.Abs(actorFleetEndPosition.x - enemyFleetEndPosition.x); // if (distanceOfFleets >= 15 * 100) // { // // Follow the target // // WarshipL warship = _actorFleet.GetWarship(11003); // Vector3 actorFocusPosition = _actorFleet._theFleetFocusPosition; // // float distance = 150.0f; // float height = 40.0f; // float moveDamping = 20.0f; // float rotationDamping = 1.5f; // // // Calculate the current rotation angles // float wantedRotationAngle = 0.0f; // float wantedHeight = actorFocusPosition.y + height; // // float currentRotationAngle = Globals.Instance.MSceneManager.mMainCamera.transform.eulerAngles.y; // float currentHeight = Globals.Instance.MSceneManager.mMainCamera.transform.position.y; // // // Damp the rotation around the y-axis // currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime); // // // Damp the height // currentHeight = Mathf.Lerp (currentHeight, wantedHeight, moveDamping * Time.deltaTime); // // // Convert the angle into a rotation // Quaternion currentRotation = Quaternion.Euler (0, currentRotationAngle, 0); // // // Set the position of the camera on the x-z plane to: // // distance meters behind the target // Globals.Instance.MSceneManager.mMainCamera.transform.position = actorFocusPosition; // Globals.Instance.MSceneManager.mMainCamera.transform.position -= currentRotation * Vector3.forward * distance; // // Globals.Instance.MSceneManager.mMainCamera.transform.position = new Vector3 (Globals.Instance.MSceneManager.mMainCamera.transform.position.x, currentHeight, Globals.Instance.MSceneManager.mMainCamera.transform.position.z); // Globals.Instance.MSceneManager.mMainCamera.transform.LookAt (actorFocusPosition); // } // // The Range of (16 cell to 12 cell) // else if (distanceOfFleets < 15 * 100 && distanceOfFleets >= 11 * 100) // { // // Calculate the look at point // Rect actorRect3D = _actorFleet._fleetRect3D; // Rect enemyRect3D = _enemyFleet._fleetRect3D; // // _actorFleet._fleetRect3DCenterPosition.x += actorRect3D.width * 0.1f; // // // Adjust the camera position and fovY(Field of view), need adjust the ratio of screen resolution? // // Confirm the target position // float xDistance = 150; // float height = 150.0f; // float moveDamping = 0.01f; // // // float camFov = Globals.Instance.MSceneManager.mMainCamera.fov; // Globals.Instance.MSceneManager.mMainCamera.fov = 60; // // float camAspect = Globals.Instance.MSceneManager.mMainCamera.aspect; // // float tan = Mathf.Tan(78 * Mathf.Deg2Rad); // float zDistance = xDistance * tan; // Tangent 60degree // // Vector3 lookAtPosition = _actorFleet._fleetRect3DCenterPosition; // Vector3 currentPosition = Globals.Instance.MSceneManager.mMainCamera.transform.position; // // float currentHeight = currentPosition.y; // float wantedHeight = lookAtPosition.y + height; // // Damp the height // currentHeight = Mathf.Lerp (currentHeight, wantedHeight, moveDamping * Time.deltaTime); // // float wantedX = Mathf.Lerp (currentPosition.x, lookAtPosition.x - xDistance, moveDamping * Time.deltaTime); // float wantedZ = Mathf.Lerp (currentPosition.z, lookAtPosition.z - zDistance, moveDamping * Time.deltaTime); // // Vector3 wantedPosition = new Vector3(wantedX, currentHeight, wantedZ); // // // Set the height of the camera // Globals.Instance.MSceneManager.mMainCamera.transform.position = wantedPosition; // Globals.Instance.MSceneManager.mMainCamera.transform.LookAt(lookAtPosition); // } // // The Range of (less equal 10 cell) // else // { // // Calculate the look at point // Rect actorRect3D = _actorFleet._fleetRect3D; // Rect enemyRect3D = _enemyFleet._fleetRect3D; // // _actorFleet._fleetRect3DCenterPosition.x += actorRect3D.width * 0.3f; // // // float camFov = Globals.Instance.MSceneManager.mMainCamera.fov; // Globals.Instance.MSceneManager.mMainCamera.fov = 60; // // float camAspect = Globals.Instance.MSceneManager.mMainCamera.aspect; // // // Adjust the camera position and fovY(Field of view), need adjust the ratio of screen resolution? // // Confirm the target position // float xDistance = 50.0f; // float height = 40.0f; // float moveDamping = 0.4f; // // float tan = Mathf.Tan(78 * Mathf.Deg2Rad); // float zDistance = xDistance * tan; // Tangent 60degree // // Vector3 lookAtPosition = _actorFleet._fleetRect3DCenterPosition; // Vector3 currentPosition = Globals.Instance.MSceneManager.mMainCamera.transform.position; // // float currentHeight = currentPosition.y; // float wantedHeight = lookAtPosition.y + height; // // Damp the height // currentHeight = Mathf.Lerp (currentHeight, wantedHeight, moveDamping * Time.deltaTime); // // float wantedX = Mathf.Lerp (currentPosition.x, lookAtPosition.x - xDistance, moveDamping * Time.deltaTime); // float wantedZ = Mathf.Lerp (currentPosition.z, lookAtPosition.z - zDistance, moveDamping * Time.deltaTime); // // Vector3 wantedPosition = new Vector3(wantedX, currentHeight, wantedZ); // // // Set the height of the camera // Globals.Instance.MSceneManager.mMainCamera.transform.position = wantedPosition; // Globals.Instance.MSceneManager.mMainCamera.transform.LookAt(lookAtPosition); // } // } // #endregion public void OnAttackStart(WarshipL warship, Skill skill) { }
public void OnAttackEnd(WarshipL warship, Skill skill) { }
public void OnWarshipCreated(WarshipL warship) { }