public bool Move(Cell targetCell, bool animate, int distance) { if (animate) { List <Cell> path = PathFinding.FindPath(MapInfos, CurrentCell, targetCell); if (path != null) { Movement.StartMovement(path, CurrentCell); ProjectionManager.SelectPath(path); } } else { transform.position = targetCell.GetVector3Position(); } if (CurrentCell != null) { CurrentCell.IsTaken = null; } CurrentCell = targetCell; CurrentCell.IsTaken = this; if (distance > 0) { AttributesSheet.AddCostAttribute(new Attribute(AttributeType.MovementPoint, -distance, PropertyType.Value, 1)); CombatUIManager.UpdateMovementPoint(AttributesSheet.GetAttribute(AttributeType.MovementPoint)); } return(true); }
//Handle object initial actions void Awake() { //Implement this as a singleton to ensure only one instance at any given time if (CombatUIManager._instance != null && CombatUIManager._instance != this) { Destroy(this.gameObject); } else { //Set this as the instance of the singleton CombatUIManager._instance = this; //Get reference for canvas object if (CanvasObject == null) { CanvasObject = GameObject.Find("Canvas"); } if (_uiContainer == null) { _uiContainer = GameObject.Find("UIContainer"); } //Initialize MenuLevel to unopened at start this.MenuLevel = GameConstants.CombatMenuPage.Unopened; //Initialize dictionaries and lists possibleTargets = new List <CharMgrScript>(); currTargets = new List <CharMgrScript>(); //Grab references to the necessary prefabs if (uiEndCombatScreen == null) { uiEndCombatScreen = (GameObject)Resources.Load("Prefabs/UI/CollectItemEmpty"); } } }
//Reactant Values: Desired, Inapplicable, Undesired. If not revealed then marked as unknown // Use this for initialization void Awake () { anim = gameObject.GetComponent<Animator>(); //Get the UI component ui = GameObject.FindGameObjectWithTag ("Combat UI").GetComponent<CombatUIManager>(); }
public override void InitializeFlow() //initialisation de tous éléments du flux { base.InitializeFlow(); cl = GameObject.FindObjectOfType <CombatLinks>(); //récupérations de tous les liens de la scene uiManager = new CombatUIManager(); uiManager.Init(); }
public void EndAnimation() { Skills[ActiveSkill].GetEffect(AttributesSheet); ActiveSkill = -1; SetState(ActionState.Waiting, false); CombatUIManager.SetActiveAllButtons(true, AttributesSheet.GetAttribute(AttributeType.MovementPoint)); CombatUIManager.UpdateSkillsButtons(); }
// Use this for initialization void Start () { //Start selected //EventSystem.current.SetSelectedGameObject (crossMenuBtns[buttonSelected].gameObject); InputController.usingController = true; ui = GameObject.FindGameObjectWithTag ("Combat UI").GetComponent<CombatUIManager>(); }
public void Awake() { if (Current == null) { Current = this; } else { Destroy(this.gameObject); } }
public void ApplyAttributeModifier(Attribute attribute) { Debug.Log(UnitName + ": " + attribute.AttributeType + " modified (" + attribute.Value + ")(" + attribute.PropertyType + ")"); int oldValue = AttributesSheet.GetAttribute(attribute.AttributeType); AttributesSheet.AddDynamicAttribute(attribute); Debug.Log(UnitName + ": " + oldValue + " => " + AttributesSheet.GetAttribute(attribute.AttributeType) + " (" + attribute.AttributeType + ")"); CombatUIManager.UpdateHealthBar(); UpdateHealthSlider(); CombatUIManager.UpdateManaBar(); }
void Awake() { MapManager = GetComponent <MapManager>(); CameraManager = GetComponent <CameraManager>(); ProjectionManager = GetComponent <ProjectionManager>(); CombatUIManager = GameObject.Find("CombatUI").GetComponent <CombatUIManager>(); TargetingManager = GetComponent <TargetingManager>(); if (SaveManager.CheckValidFileSave(Scene.Battleground)) { BattlegroundData = SaveManager.LoadBattleground(); } MapManager.GenerateMaps(BattlegroundData.MapInfos); }
public void SkillUse(Cell targetCell) { AttributesSheet.AddCostAttribute(new Attribute((AttributeType)Skills[ActiveSkill].CostType, -Skills[ActiveSkill].Cost, PropertyType.Value, 0)); AttributesSheet.CurrentMana -= Skills[ActiveSkill].ManaCost; if (Skills[ActiveSkill].CostType == CostType.ActionPoint) { CombatUIManager.UpdateActionPoint(AttributesSheet.GetAttribute(AttributeType.ActionPoint)); } else if (Skills[ActiveSkill].CostType == CostType.MovementPoint) { CombatUIManager.UpdateMovementPoint(AttributesSheet.GetAttribute(AttributeType.MovementPoint)); } if (Skills[ActiveSkill].Cooldown != 0) { SkillsCooldowns[ActiveSkill] = Skills[ActiveSkill].Cooldown; } if (Skills[ActiveSkill].UsePerTurn != -1) { SkillsUses[ActiveSkill]--; } if (Skills[ActiveSkill].Animations != null && Skills[ActiveSkill].Animations.Count > 0) { SetState(ActionState.PlayingAnimation, false); CombatUIManager.SetActiveAllButtons(false, 0); for (int i = 0; i < Skills[ActiveSkill].Animations.Count; i++) { StartCoroutine(Skills[ActiveSkill].Animations[i].Play(Animator, CurrentCell, targetCell, () => EndAnimation())); } } else { Skills[ActiveSkill].GetEffect(AttributesSheet); ActiveSkill = -1; SetState(ActionState.Waiting, false); CombatUIManager.UpdateSkillsButtons(); } CombatUIManager.UpdateManaBar(); }
public override IEnumerator Turn() { InitTurn(); Debug.Log("(Player) " + UnitName + " turn"); CombatUIManager.RefreshUI(); CombatUIManager.SetActiveAllButtons(true, AttributesSheet.GetAttribute(AttributeType.MovementPoint)); CombatUIManager.UpdateSkillsButtons(); while (ActionState != ActionState.EndTurn && IsAlive) { switch (ActionState) { case ActionState.LookingForMovement: if (AttributesSheet.GetAttribute(AttributeType.MovementPoint) != 0) { if (ProjectionManager.SelectionState != SelectionState.AvailableMovement) { ProjectionManager.SelectAvailableMovement(CurrentCell, AttributesSheet.GetAttribute(AttributeType.MovementPoint), SelectionState.AvailableMovement); } } else { Debug.Log("Can't move, no movementPoint available"); ActionState = ActionState.Waiting; } break; case ActionState.Waiting: if (ProjectionManager.SelectionState != SelectionState.CurrentCell && ProjectionManager.SelectionState != SelectionState.OtherAvailableMovement) { ProjectionManager.SelectCurrentCell(CurrentCell, Team); } break; default: break; } yield return(new WaitForFixedUpdate()); } AttributesSheet.RemoveCosts(); ProjectionManager.ClearProjections(); SelfProjection.gameObject.SetActive(true); IsPlaying = false; yield return(null); }
// Initialization and Start of Combat void Start() { playerObjectScript = FindObjectOfType <PlayerScript>(); enemyObjectScript = FindObjectOfType <EnemyScript>(); playerChar = playerObjectScript.GetPlayerCharacter(); enemyChar = enemyObjectScript.GetEnemyCharacter(); playerSkillScript = playerObjectScript.GetPlayerSkillScript(); enemySkillScript = enemyObjectScript.GetEnemySkillScript(); myCombatUIManager = FindObjectOfType <CombatUIManager>(); myBattleBGMScript = FindObjectOfType <BattleBGMScript>(); myBattleBGMScript.BeginBattleBGM(); StartCoroutine(StartCombatProcedure()); }
// Use this for initialization void Start() { myAudioSource = GetComponentInChildren <AudioSource>(); myCombatManager = FindObjectOfType <CombatManager>(); myCombatUIManager = FindObjectOfType <CombatUIManager>(); myAnimatorController = GetComponent <Animator>(); if (GetComponent <EnemyScript>()) { EnemyInfo thisEnemyInfo = GetComponent <EnemyScript>().GetThisEnemyInfo(); SettingUpEnemy(thisEnemyInfo); } InitializingCharacterHealthAndHealthUI(); InitializingCharacterStats(); InitializingCharacterBuffDebuffList(); }
public void InitTurn() { ActiveSkill = -1; if (!IsPlaying) { AttributesSheet.UpdateAttributesDuration(); UpdateSkillsCooldowns(); UpdateSkillsUses(); } IsPlaying = true; CombatUIManager.UpdateActionPoint(AttributesSheet.GetAttribute(AttributeType.ActionPoint)); CombatUIManager.UpdateMovementPoint(AttributesSheet.GetAttribute(AttributeType.MovementPoint)); SelfProjection.gameObject.SetActive(false); ActionState = ActionState.Waiting; }
public void ApplyDamage(AttributesSheet casterAttributes, DamageLine line, bool isCritical, Weapon weapon = null) { float value = line.FinalValue; if (isCritical) { value *= 1.5f + casterAttributes.GetCriticalDamageModifier(); } Debug.Log(UnitName + ": damaged " + value + " (" + line.DamageType + ")(" + line.ElementType + ")(" + isCritical + ")"); int oldValue = AttributesSheet.CurrentHealth; AttributesSheet.CurrentHealth -= (int)value; Debug.Log(UnitName + ": " + oldValue + " => " + AttributesSheet.CurrentHealth); Animator.Play(AnimationPrefix + "Take Damage"); CombatUIManager.UpdateHealthBar(); UpdateHealthSlider(); UpdateIsAlive(); }
// Use this for initialization void Start() { myCombatUIManager = FindObjectOfType <CombatUIManager>(); thisCharacter = GetComponent <Character>(); myAudioSource = skillEffectObject.GetComponent <AudioSource>(); // If its enemy if (GetComponent <EnemyScript>() != null) { SetupEnemySkills(); } else { ClearEmptyPlayerSkillSlots(); } // Setting every skill to designated types foreach (SkillInfo skill in thisCharacterSkills) { skill.SettingSkillType(); } }
public void ApplyRecovery(AttributesSheet casterAttributes, RecoveryLine line, bool isCritical) { float value = line.finalValue; if (isCritical) { value *= 1.5f + casterAttributes.GetCriticalDamageModifier(); } Debug.Log(UnitName + ": recovered " + value + " (" + line.recoveryType + ")(" + isCritical + ")"); if (line.recoveryType == RecoveryType.Health) { AttributesSheet.CurrentHealth += (int)value; } else if (line.recoveryType == RecoveryType.Mana) { AttributesSheet.CurrentMana += (int)value; } CombatUIManager.UpdateHealthBar(); UpdateHealthSlider(); CombatUIManager.UpdateManaBar(); }
public void initializeCombat(CombatUIManager combatUIManager) { this.combatUIManager = combatUIManager; }
// Use this for initialization void Start() { //Initialise Combat UI Manager ui = GameObject.FindGameObjectWithTag ("Combat UI").GetComponent<CombatUIManager>(); if(stat.shieldMax > 0) //If this has a shield { //Calculate its weakness and strength switch(stat.shieldAffinity) { case 1: //The affinity is Earth shieldWeakness = 2; //Weakness is Fire shieldResistance = 3; //Resistant to Lightning break; case 2: //The affinity is Fire shieldWeakness = 4; //Weakness is water shieldResistance = 1; //Resistant to Earth break; case 3: //The affinity is lightning shieldWeakness = 1; //Weakness is Earth shieldResistance = 4; //Resistant to water break; case 4: //The affinity is Water shieldWeakness = 3; //Weakness is Lightning shieldResistance = 2; //Resistant to Fire break; } } }
// Use this for initialization void Start () { //Intro Animate if(GameObject.FindGameObjectWithTag ("Combat Manager")) { Invoke ("IntroAnimate", GameObject.FindGameObjectWithTag ("Combat Manager").GetComponent<CombatManager>().battleStartTime - 1.5f); } //Initialise AP Cost for(int i = 0; i < elementalAPCost.Length; i++) { elementalAPCost[i] = 5; } overwatchIndex = -1; //Make sure this doesn't start with 0; //Initialise Combat UI Manager ui = GameObject.FindGameObjectWithTag ("Combat UI").GetComponent<CombatUIManager>(); if(stat.shieldMax > 0) //If this has a shield { //Calculate its weakness and strength switch(stat.shieldAffinity) { case 1: //The affinity is Earth shieldWeakness = 2; //Weakness is Fire shieldResistance = 3; //Resistant to Lightning break; case 2: //The affinity is Fire shieldWeakness = 4; //Weakness is water shieldResistance = 1; //Resistant to Earth break; case 3: //The affinity is lightning shieldWeakness = 1; //Weakness is Earth shieldResistance = 4; //Resistant to water break; case 4: //The affinity is Water shieldWeakness = 3; //Weakness is Lightning shieldResistance = 2; //Resistant to Fire break; } } }
private void Awake() { CameraCenterController = cam.GetComponent <CameraCenterController>(); CombatUIManager = combatUI.GetComponent <CombatUIManager>(); PlayerCombatController = player.GetComponent <PlayerCombatController>(); }
private void Start() { combatUIManager = GameObject.FindGameObjectWithTag("combatMenu").GetComponent <CombatUIManager>(); }
// Use this for initialization void Start () { //Initialise Combat UI Manager ui = GameObject.FindGameObjectWithTag ("Combat UI").GetComponent<CombatUIManager>(); enemyUI = gameObject.GetComponent<EnemyUI>(); //Enemies begin with a Random Affinity if(randomHealthAffinity) { affinity = Random.Range (1, 5); //Inserting this code because it never ever hits 4 and 5 is not desired if(affinity == 5) { affinity --; } } else { affinity = forcedHealthAffinity; } if(randomShieldAffinity) { shieldAffinity = Random.Range (1, 5); //Inserting this code because it never ever hits 4 and 5 is not desired if(shieldAffinity == 5) { shieldAffinity --; } } else { shieldAffinity = forcedShieldAffinity; } //Initiate shield shieldMax = shield; //Describe the weakness and strength of this enemy's affinity switch (affinity) { case 1: //The affinity is Earth affinityWeakness = 2; //Weakness is Fire affinityResistance = 3; //Resistant to Lightning break; case 2: //The affinity is Fire affinityWeakness = 4; //Weakness is water affinityResistance = 1; //Resistant to Earth break; case 3: //The affinity is lightning affinityWeakness = 1; //Weakness is Earth affinityResistance = 4; //Resistant to water break; case 4: //The affinity is Water affinityWeakness = 3; //Weakness is Lightning affinityResistance = 2; //Resistant to Fire break; } if(shield > 0) //If this enemy has a shield { //Calculate its weakness and strength switch(shieldAffinity) { case 1: //The affinity is Earth shieldWeakness = 2; //Weakness is Fire shieldResistance = 3; //Resistant to Lightning break; case 2: //The affinity is Fire shieldWeakness = 4; //Weakness is water shieldResistance = 1; //Resistant to Earth break; case 3: //The affinity is lightning shieldWeakness = 1; //Weakness is Earth shieldResistance = 4; //Resistant to water break; case 4: //The affinity is Water shieldWeakness = 3; //Weakness is Lightning shieldResistance = 2; //Resistant to Fire break; } } for(int i = 0; i < healthAffinitySwitchObjects.Length; i++) { healthAffinitySwitchObjects[i].GetComponent<Renderer>().material = healthAffinityMaterials[0]; } for(int i = 0; i < shieldAffinitySwitchObjects.Length; i++) { shieldAffinitySwitchObjects[i].GetComponent<Renderer>().material = shieldAffinityMaterials[0]; } }
public override IEnumerator Turn() { InitTurn(); Debug.Log("(Enemy) " + UnitName + " turn"); CombatUIManager.RefreshUI(); CombatUIManager.UpdateSkillsButtons(); CombatUIManager.SetActiveAllButtons(false, 0); ProjectionManager.SelectCurrentCell(CurrentCell, Team); // GET MOST EFFICIENT TURN CombatUIManager.ToggleThinkingAI(true); yield return(GetTurn()); CombatUIManager.ToggleThinkingAI(false); // PLAY TURN if (AITurn != null && AITurn.Actions != null) { foreach (AIAction action in AITurn.Actions) { if (action is AIActionMovement) { AIActionMovement movementAction = action as AIActionMovement; Cell cellDestination = MapInfos.Map[(int)movementAction.Destination.x, (int)movementAction.Destination.y]; Debug.Log("Move from [" + CurrentCell.X + ", " + CurrentCell.Z + "] to [" + cellDestination.X + ", " + cellDestination.Z + "]"); // ProjectionManager.SelectAvailableMovement(); // yield return new WaitForSeconds(0.5f); Move(cellDestination, true, Utils.GetDistanceBetweenCells(CurrentCell, cellDestination)); while (ActionState == ActionState.Moving) { yield return(new WaitForEndOfFrame()); } } else if (action is AIActionUseSkill) { AIActionUseSkill useSkillAction = action as AIActionUseSkill; Debug.Log("Use " + useSkillAction.SpellId + " at [" + useSkillAction.SpellTarget.X + ", " + useSkillAction.SpellTarget.Z + "]"); SkillDisplayRange(useSkillAction.SpellId); yield return(new WaitForSeconds(0.5f)); SkillDisplayAoe(useSkillAction.SpellTarget); yield return(new WaitForSeconds(0.5f)); SkillUse(useSkillAction.SpellTarget); while (ActionState == ActionState.PlayingAnimation) { yield return(new WaitForEndOfFrame()); } } } } // END TURN AttributesSheet.RemoveCosts(); ProjectionManager.ClearProjections(); SelfProjection.gameObject.SetActive(true); IsPlaying = false; yield return(null); }
// Initialize void Awake() { Debug.Log("CombatManager Awake"); if (Instance == null) { Instance = this; } else { Destroy(gameObject); } BoardManager = GetComponent<CombatBoardManager>(); OverlayManager = GetComponent<HexOverlayManager>(); UIManager = GetComponent<CombatUIManager>(); // Combat entrance animations // Set up board, objects, UI InitializeCombat(); // Initialize UI elements (player skills, health, items) InitializeUI(); // Start the game _turnState = TurnState.StartPlayerTurn; }
public virtual void Awake() { uiManager = GameObject.Find("UIRoot").GetComponent <CombatUIManager>(); }
void Awake() { instance = this; }