public ETeam GetAbilityTargetTeam(EAllegiance abilityAllegiance) { switch (m_team) { case ETeam.Neutral: case ETeam.Blue: if (abilityAllegiance == EAllegiance.Allied) { return(ETeam.Blue); } else { return(ETeam.Red); } case ETeam.Red: if (abilityAllegiance == EAllegiance.Allied) { return(ETeam.Red); } else { return(ETeam.Blue); } default: return(ETeam.Neutral); } }
public override void TakeDamage(float incomingDamage, EAllegiance allegianceOfIncomingDamage) { if (allegianceOfIncomingDamage != allegiance && health > 0) { health -= incomingDamage; if (this.GetComponent <ColorTweening>()) { this.GetComponent <ColorTweening>().FlashWhite(); } else if (this.GetComponent <ShaderTweening>()) { this.GetComponent <ShaderTweening>().FlashWhite(); } else if (this.GetComponent <EnemyHit>()) { this.GetComponent <EnemyHit>().VisuallyShowEnemyHit(); } //enemyHitScript.FlashWhite(); //enemyHitScript.VisuallyShowEnemyHit(); //Debug.Log(this + " Is taking damage"); if (health <= 0 && !isDying) { Die(); isDying = true; } } }
public virtual void TakeDamage(float incomingDamage, EAllegiance allegianceOfIncomingDamage) { if (allegianceOfIncomingDamage != allegiance) { health -= incomingDamage; //Debug.Log(this + " Is taking damage"); if (health <= 0) { GameObject.Destroy(this.gameObject); } } }
// upon its death, update playerScore public override void TakeDamage(float incomingDamage, EAllegiance allegianceOfIncomingDamage) { if (allegianceOfIncomingDamage != allegiance) { health -= incomingDamage; //Debug.Log(this + " Is taking damage"); if (health <= 0) { MissionManager.IncreasePlayerScore(pointValue); if (objectType == ETerrainObjectType.Target) { MissionManager.DecreaseTargetCount(); } GameObject.Destroy(this.gameObject); } } }
/// <summary> /// Cast a Ray to find a Entity Based on allegiance /// </summary> /// <param name="entity">Current Entity</param> /// <param name="allegiance">Allegiance</param> /// <param name="mask">Layer Mask</param> /// <param name="entityHit">Hit Entity</param> /// <returns></returns> public static bool RaycastHitEntity(MobaEntity entity, EAllegiance allegiance, LayerMask mask, Vector2 screenPosition, out MobaEntity entityHit) { entityHit = null; RaycastHit[] raycastArray = Physics.RaycastAll(CameraController.instance.sources.currentCamera.ScreenPointToRay(screenPosition), Mathf.Infinity, mask); foreach (RaycastHit ray in raycastArray) { entityHit = ray.transform.GetComponent <MobaEntity>(); if (entityHit) { //If the player clicks on any entity with the current allegiance, return true if (entity.GetTargetAllegiance(entityHit) == allegiance) { Debug.Log("Entity Clicked: " + entityHit.name); return(true); } } } return(false); }
public void CmdAttackEntityOnServer(string entityId) { MobaEntity entity = GameManager.instance.GetMobaEntity(entityId); Ability ability = m_characterEntity.EntityAbilities.GetAbility(EAttackType.Basic); if (entity == null || ability == null || m_characterEntity.Dead || m_characterEntity.IsStun) { return; } EAllegiance targetAllegiance = m_characterEntity.GetTargetAllegiance(entity); switch (targetAllegiance) { case EAllegiance.Allied: break; case EAllegiance.Hostile: if (!m_characterEntity.EntityAbilities.IsCasting) { if (!m_characterEntity.EntityBehaviour.HasBehaviours) { m_characterEntity.EntityBehaviour.AddBehaviour(new AbilitySimpleTarget(m_characterEntity, entity, ability)); } else { if (m_characterEntity.EntityBehaviour.CurrentBehaviour.BehaviourAttacktype != EAttackType.Basic) { m_characterEntity.EntityBehaviour.StopAllBehaviours(); m_characterEntity.EntityBehaviour.AddBehaviour(new AbilitySimpleTarget(m_characterEntity, entity, ability)); } } } break; default: break; } }
public override void TakeDamage(float incomingDamage, EAllegiance allegianceOfIncomingDamage) { if (allegianceOfIncomingDamage != allegiance) { if (allegianceOfIncomingDamage == EAllegiance.Enemy) { repSysMan.RollForSteamLoss(); FindObjectOfType <AudioManager>().PlayGotHit(); } health -= incomingDamage; if (health > maxHealth) { health = maxHealth; } if (incomingDamage >= 20.0f) { FindObjectOfType <AudioManager>().PlayMissleHit(); } else { //FindObjectOfType<AudioManager>().PlayGotHit(); } if (health <= 50 && !alarmPlaying) { FindObjectOfType <AudioManager>().PlayAlarm(); alarmPlaying = true; } //Debug.Log(this + " Is taking damage"); if (health <= 0 && !died) { Die(); } } }
public int DrawAbility(int posX, int yPos, int maxLevel, GUISkin skin) { int initPos = yPos; #if UNITY_EDITOR //EditorStyles.textField.fontStyle = FontStyle.Bold; m_icon = (Sprite)EditorGUI.ObjectField(new Rect(posX, yPos, 70, 70), m_icon, typeof(Sprite), false); yPos += 70; m_identifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_identifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Identifier", "Ability identifier used to identity and load abilities"), skin.label); m_abilityName = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_abilityName, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Description Name: ", "Ability name to show"), skin.label); m_attackType = (EAttackType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_attackType); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Type: ", "Ability type"), skin.label); m_requiresTarget = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_requiresTarget); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Requires Target?: ", "Select this if the current ability requires targetting. The target could be a Position or Entity"), skin.label); m_faceTarget = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_faceTarget); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Look Target?: ", "Select this if you want the entity to face the target while casting the ability"), skin.label); if (m_requiresTarget) { posX += 40; m_targetType = (ETargetType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_targetType); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Target Type: ", "Select the type of the target that you want the ability to make effect."), skin.label); if (m_targetType != ETargetType.SelfTarget) { m_allegiance = (EAllegiance)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_allegiance); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Target Allegiance: ", "Select the allegiance to be used by the ability to filter targets or detect collisions."), skin.label); } if (m_targetType != ETargetType.SelfTarget && m_targetType != ETargetType.AllTarget) { m_maxTargets = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_maxTargets, 1, 10); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Max Targets: ", "Max targets the ability will try go cast the ability on."), skin.label); } posX -= 40; if (m_targetType == ETargetType.PositionTarget) { m_skillShotType = (ESkillShotType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_skillShotType); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("SkillShot Type: ", "If the target type is a Position Target. \nFrontSkill: The ability will be casted from the entity to the target direction. \nFloorSkill: The ability will be casted from the floor position."), skin.label); if (m_skillShotType == ESkillShotType.FrontSkill) { m_detectionRange = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 150, 20), m_detectionRange, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Collision Detection Range: ", "This is the distance the ability will be using to detect collisions. \nRecommended Setting: 0.3f"), skin.label); } } m_indicatorPrefab = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_indicatorPrefab, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Indicator Prefab: ", "This is the Indicator used to handle the gizmo logic to show the ability range, position or direction. \nDefault Values: \n-SimpleIndicator"), skin.label); if (m_targetType == ETargetType.PositionTarget) { m_targetImageIndicator = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_targetImageIndicator, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Target Indicator Image: ", "This is the Target Image loaded by the Indicator. \nDefault Values: \n-SimpleFloorImage \n-SimpleFrontImage"), skin.label); } m_rangeImageIndicator = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_rangeImageIndicator, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Range Indicator Image: ", "This is the Range Image loaded by the Indicator to show the ability Range to the player. \nDefault Values: \n-SimpleRangueImage"), skin.label); } else { } GUI.color = new Color(0f, .8f, .8f, 0.15f); //GUI.Box(new Rect(posX, initPos, 350, (yPos - initPos) + 20), ""); GUI.color = Color.white; yPos += 30; //Casting Parameters m_playCastAnimation = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_playCastAnimation); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Play Cast Animation? "), skin.label); if (m_playCastAnimation) { posX += 40; m_castingAnimation = (EEntityState)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_castingAnimation); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Cast Animation: "), skin.label); m_castTime = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 180, 20), m_castTime, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Casting Time"), skin.label); m_castParticleIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_castParticleIdentifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Cast Particle Identifier"), skin.label); posX -= 40; } //Animation Parameters m_playAbilityAnimation = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_playAbilityAnimation); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Plays Ability Anim? ", "Mark this if the ability runs animations."), skin.label); if (m_playAbilityAnimation) { posX += 40; m_animation = (EEntityState)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_animation); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Animation: "), skin.label); posX -= 40; } if (m_playCastAnimation || m_playAbilityAnimation) { m_launchingType = (ELaunchingState)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_launchingType); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch State: "), skin.label); m_animationPercentLaunch = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_animationPercentLaunch, 0, 100); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Anim Percent Launch"), skin.label); } m_processor = (AbilityProcessorType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_processor); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability processor type"), skin.label); switch (m_processor) { case AbilityProcessorType.DamageImpact: break; case AbilityProcessorType.LaunchAbility: posX += 40; m_projectileIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 180, 20), m_projectileIdentifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Projectile Prefab Identifier"), skin.label); m_projectileQuantity = EditorGUI.IntField(new Rect(posX + 150, yPos += 20, 180, 20), m_projectileQuantity, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Projectile Quantity"), skin.label); m_projectileSpeed = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 180, 20), m_projectileSpeed, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Projectile Speed"), skin.label); posX -= 40; break; case AbilityProcessorType.CastSideEffectsOnly: m_damageLogic = EDamageLogic.None; break; default: break; } if (m_processor != AbilityProcessorType.CastSideEffectsOnly) { m_launchPos = (EEntityTransform)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_launchPos); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability launch Position"), skin.label); m_launchParticleIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_launchParticleIdentifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Particle Prefab Identifier"), skin.label); m_launchParticlePercentLaunch = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_launchParticlePercentLaunch, 0, 100); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Particle Animation Percent"), skin.label); m_impactParticleIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_impactParticleIdentifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Impact Particle Prefab Identifier"), skin.label); m_launchSoundIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_launchSoundIdentifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Sound Identifier"), skin.label); m_launchSoundVolume = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_launchSoundVolume, 0, 100); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Sound Volume"), skin.label); m_impactSoundIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_impactSoundIdentifier, skin.textField); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Impact Sound Identifier"), skin.label); m_impactSoundVolume = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_impactSoundVolume, 0, 100); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Impact Sound Volume"), skin.label); posX += 400; yPos = 150; m_damageLogic = (EDamageLogic)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_damageLogic); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Damage Logic"), skin.label); } if (m_damageLogic != EDamageLogic.None) { m_canDamageTowers = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_canDamageTowers); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Can Damage towers?: "), skin.label); if (m_damageLogic == EDamageLogic.DamageAoeLogic) { m_aoeRange = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 180, 20), m_aoeRange); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Damage Aoe Range"), skin.label); } } else { //Damage logic == none } int prevPosX = posX; m_canLevelUp = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_canLevelUp); EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Can level up?: "), skin.label); if (m_canLevelUp) { while (m_abilityDamageData.Count < maxLevel) { m_abilityDamageData.Add(new AbilityDamageData()); } } else { if (m_abilityDamageData.Count == 0) { m_abilityDamageData.Add(new AbilityDamageData()); } if (m_abilityDamageData.Count > 1) { m_abilityDamageData.RemoveRange(1, m_abilityDamageData.Count - 1); } } yPos += 20; for (int i = 0; i < m_abilityDamageData.Count; i++) { if (i == 0) { EditorGUI.LabelField((new Rect(posX, yPos + 20, 180, 20)), new GUIContent("Base Damage"), skin.label); EditorGUI.LabelField((new Rect(posX, yPos + 40, 180, 20)), new GUIContent("Base Ability"), skin.label); EditorGUI.LabelField((new Rect(posX, yPos + 60, 180, 20)), new GUIContent("Range"), skin.label); EditorGUI.LabelField((new Rect(posX, yPos + 80, 180, 20)), new GUIContent("ColdDown"), skin.label); EditorGUI.LabelField((new Rect(posX, yPos + 100, 180, 20)), new GUIContent("ManaCost"), skin.label); posX += 100; } EditorGUI.LabelField((new Rect(posX + (50 * i), yPos, 180, 20)), new GUIContent("Lvl: " + (i + 1)), skin.label); m_abilityDamageData[i].BaseAdDamage = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].BaseAdDamage); m_abilityDamageData[i].BaseApDamage = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].BaseApDamage); m_abilityDamageData[i].Range = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].Range); if (m_abilityDamageData[i].Range < 1) { m_abilityDamageData[i].Range = 1; } m_abilityDamageData[i].ColdDownSeconds = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].ColdDownSeconds); m_abilityDamageData[i].ManaCost = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].ManaCost); yPos -= 5 * 20; } posX -= 400; yPos += 5 * 20; posX = prevPosX; yPos += 30; m_abilityDescription = EditorGUI.TextArea(new Rect(posX, yPos += 20, 300, 20 + 60), m_abilityDescription); yPos += 60; if (GUI.Button(new Rect(posX, yPos += 20, 300, 20), "Add Description Param")) { m_descriptionParamList.Add(new EDescriptionParameter()); return(0); } for (int i = 0; i < m_descriptionParamList.Count; i++) { m_descriptionParamList[i] = (EDescriptionParameter)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_descriptionParamList[i]); EditorGUI.LabelField((new Rect(posX, yPos, 180, 20)), new GUIContent("Param Number: " + i), skin.label); } //Effects Parameters yPos = initPos; GUIStyle m_boldStyle = new GUIStyle(); m_boldStyle.fontSize = 18; m_boldStyle.fontStyle = FontStyle.Bold; EditorGUI.LabelField(new Rect(posX + 400, yPos - 40, 300, 20), new GUIContent("Side Effects Configuration"), skin.GetStyle("BoldText")); m_effectClasses = GetEffectClasses(); m_effectClassIndex = EditorGUI.Popup(new Rect(posX + 400, yPos += 20, 300, 20), m_effectClassIndex, m_effectClasses); GUI.color = Color.green; if (GUI.Button(new Rect(posX + 400, yPos += 20, 300, 20), "Add Side Effect")) { SideEffect effect = ScriptableObjectUtility.CreateAsset(m_effectClasses[m_effectClassIndex], Identifier); effect.EffectIdentifier = Identifier + "-" + m_effectClasses[m_effectClassIndex]; m_sideEffects.Add(effect); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); return(0); } GUI.color = Color.white; yPos += 30; for (int i = 0; i < m_sideEffects.Count; i++) { //GUI.contentColor = Color.cyan; EditorGUI.LabelField((new Rect(posX + 400, yPos += 20, 300, 20)), new GUIContent("Effect Type: " + m_sideEffects[i].GetType().ToString()), skin.label); int boxPosY = yPos; yPos = m_sideEffects[i].DrawEffect(posX + 400, yPos, skin); //GUI.color = Color.cyan; GUI.Box(new Rect(posX + 390, boxPosY, 8, (yPos - boxPosY) + 20), ""); //GUI.color = Color.red; EditorGUI.LabelField((new Rect(posX + 400, yPos += 20, 300, 20)), new GUIContent("Remove this effect "), skin.GetStyle("RedText")); if (GUI.Button(new Rect(posX + 550, yPos, 20, 20), "", skin.GetStyle("RemoveButton"))) { string path = AssetDatabase.GetAssetPath(m_sideEffects[i]); AssetDatabase.DeleteAsset(path); m_sideEffects.RemoveAt(i); break; } // if (GUI.Button(new Rect(posX + 400, yPos += 20, 300, 20), "Remove This Effect")) //{ // //} //GUI.color = Color.white; yPos += 20; } EditorUtility.SetDirty(this); #endif return(yPos - initPos); }
public override void Process() { if (!m_characterEntity || m_characterEntity.Dead || m_characterEntity.isServer || !GameManager.instance.IsLocalCharacter(m_characterEntity)) { return; } if (GameManager.instance.IsGameOver) { if (m_characterEntity.EntityBehaviour.HasBehaviours) { m_characterEntity.EntityBehaviour.StopAllBehaviours(); } return; } if (m_keyAction) { m_keyAction = false; //If there an active indicator, deactivate if (m_indicator) { SpawnManager.instance.DestroyPool(m_indicator.gameObject); m_indicator = null; return; } else { MoveOrTarget(); return; } } if (m_keySelect) { m_keySelect = false; if (m_indicator != null) { if (TryToCastAbilityOnClient(m_indicator.AttackType, true)) { SpawnManager.instance.DestroyPool(m_indicator.gameObject); m_indicator = null; return; } } } if (m_keyQ) { m_keyQ = false; if (TryToCastAbilityOnClient(EAttackType.Q, m_characterEntity.EntityAbilities.SmartCast)) { return; } } if (m_keyW) { m_keyW = false; if (TryToCastAbilityOnClient(EAttackType.W, m_characterEntity.EntityAbilities.SmartCast)) { return; } } if (m_keyE) { m_keyE = false; if (TryToCastAbilityOnClient(EAttackType.E, m_characterEntity.EntityAbilities.SmartCast)) { return; } } if (m_keyR) { m_keyR = false; if (TryToCastAbilityOnClient(EAttackType.R, m_characterEntity.EntityAbilities.SmartCast)) { return; } } if (m_keyStop) { m_keyStop = false; CmdStopKeyClicked(); } #if (!UNITY_IOS && !UNITY_ANDROID) RaycastHit hit; if (Physics.Raycast(CameraController.instance.sources.currentCamera.ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity, GameManager.instance.Mask)) { MobaEntity entityHit = hit.transform.GetComponent <MobaEntity>(); if (entityHit != null) { if (m_selectedEntity == entityHit) { return; } if (m_selectedEntity != null) { m_selectedEntity.Renderer.material.SetColor("_OutlineColor", Color.black); } m_selectedEntity = entityHit; EAllegiance allegiance = m_characterEntity.GetTargetAllegiance(m_selectedEntity); Color allegianceColor = Color.black; switch (allegiance) { case EAllegiance.Allied: allegianceColor = Color.white; GameManager.instance.SetCursor(ECursors.Cursor_Default); break; case EAllegiance.Hostile: allegianceColor = Color.red; GameManager.instance.SetCursor(ECursors.Cursor_Attack); break; default: break; } entityHit.Renderer.material.SetColor("_OutlineColor", allegianceColor); } else { GameManager.instance.SetCursor(ECursors.Cursor_Default); if (m_selectedEntity != null) { m_selectedEntity.Renderer.material.SetColor("_OutlineColor", Color.black); } m_selectedEntity = null; } } #endif }