private void Update() { if (isValid) { OnValidEnergy(AbilityManager.GetEnergy() >= ability.GetCost()); } }
public void OnSelectAbility(GameObject butObj) { int newID = 0; for (int i = 0; i < abilityItemList.Count; i++) { if (butObj == abilityItemList[i].buttonObj) { newID = i; break; } } int abilityID = AbilityManager.GetSelectID(); if (newID == abilityID) { return; } abilityItemList[newID].selectHighlight.SetActive(true); abilityItemList[newID].button.interactable = false; abilityItemList[abilityID].selectHighlight.SetActive(false); abilityItemList[abilityID].button.interactable = true; AbilityManager.Select(newID); }
public override void Act(AbilityManager manager) { target.GetComponent <CharacterStats>().stats.TakeDamage(amount); damaged.Add(target); //if target's collider is touching others, they take damage too foreach (var enemy in target.GetComponent <HitboxCollision>().touching) { if (!damaged.Contains(enemy) && !enemy.GetComponent <CharacterStats>().stats.dead) { enemy.GetComponent <CharacterStats>().stats.TakeDamage(amount); damaged.Add(enemy); } // and enemies they touch foreach (var e in enemy.GetComponent <HitboxCollision>().touching) { if (!damaged.Contains(e) && !e.GetComponent <CharacterStats>().stats.dead) { e.GetComponent <CharacterStats>().stats.TakeDamage(amount); damaged.Add(e); } } } foreach (var enemy in damaged) { if (!target.GetComponent <CharacterStats>().stats.dead) { enemy.GetComponent <StateController>().CauseAggro(); } } damaged.Clear(); }
// Update void OnHeroSwitch(GameObject hero, GameObject reciever = null) { _heroAbilities = hero.GetComponent <AbilityManager>(); _heroStats = hero.GetComponent <BasicStatManager>(); // Setup ability ui if (_heroAbilities != null) { Ability1UI.Enable(); Ability2UI.Enable(); Ability1UI.SetUIElements(_heroAbilities.Ability1.AbilityName, _heroAbilities.Ability1.UISprite); Ability2UI.SetUIElements(_heroAbilities.Ability2.AbilityName, _heroAbilities.Ability2.UISprite); } else { Ability1UI.Disable(); Ability2UI.Disable(); } if (_heroStats != null) { HeroNameText.text = _heroStats.name; } // Move marker to current hero }
void OnUpdateEnergy(float val) { if (val >= AbilityManager.GetMaximumEnergy()) { PlayEnergyFullSound(); } }
public void Init() { if (isInit == true) { return; } isInit = true; thisTransform = this.transform; AIBase = thisTransform.GetComponent <AIBase>(); health = thisTransform.GetComponent <Health>(); if (abilityManager == null) { abilityManager = GameObject.FindGameObjectWithTag("AbilityManager").GetComponent <AbilityManager>(); } for (int i = 0; i < abilityNames.Length; i++) { abilityIndexes.Add(abilityManager.GetAbilityIndex(abilityNames[i])); } for (int i = 0; i < abilityIndexes.Count; i++) { InitAbility(abilityIndexes[i]); //kan ju inte bara init denna coz det är ett kinda abstrakt värde, init ska ske på denna unitspellhandlern själv } Reset(); AIBase.LoadValidSpellIndexes(); //viktigt att denne kallar, AIbase klarar ju inte av det själv :/ men den hinner inte fixa alla abilitylistor innan den vill retrieva annars }
void Start() { instance = GetComponent <AbilityManager>(); SetAbil(Ability0); SetAbil(Ability1); SetAbil(Ability2); }
private void Start() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } _abilityIcons = new Dictionary <string, Sprite> { { "bash", BashIcon }, { "knockback", KnockBackIcon }, { "stab", StabIcon }, { "divine aid", DivineAidIcon }, { "spin web", SpinWebIcon } }; if (_abilityMap == null) { PrepareAbilityMap(); } }
public static void loadDataFile() { AbilityManager.clearList(); List <Ability> tempAbilityList; using (Stream stream = File.Open("Assets/Resources/Data/Abilities", FileMode.Open)) { var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); abilityList.Clear(); tempAbilityList = (List <Ability>)binaryFormatter.Deserialize(stream); stream.Close(); } string tempInternalName; string tempName; string tempDesc; foreach (Ability ability in tempAbilityList) { tempInternalName = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(ability.internalName)); tempName = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(ability.name)); tempDesc = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(ability.description)); abilityList.Add(new Ability(tempInternalName, tempName, tempDesc)); } }
// AnimLib Ability Packet structure: // // 1 or 2 bytes Mod_Count // foreach Mod_Count: // X bytes Mod_Name // 1 or 2 bytes Ability_Count // foreach Ability_Count: // 1 or 2 bytes Ability_ID // [ Remaining handled by Ability[AbilityID].Read()/.Write() ] internal override void HandlePacket(BinaryReader reader, int fromWho) { AnimPlayer fromPlayer = Main.player[fromWho].GetModPlayer <AnimPlayer>(); int modCount = reader.ReadLowestCast(ModNet.NetModCount); for (int i = 0; i < modCount; i++) { Mod mod = ModLoader.GetMod(reader.ReadString()); AbilityManager manager = fromPlayer.characters[mod].abilityManager; if (manager is null) { continue; } int abilityCount = reader.ReadLowestCast(manager.abilityArray.Length); for (int j = 0; j < abilityCount; j++) { int abilityId = reader.ReadLowestCast(manager.abilityArray.Length); Ability ability = manager[abilityId]; ability.PreReadPacket(reader); } } if (Main.netMode == NetmodeID.Server) { SendPacket(-1, fromWho); } }
private void Awake() { if (instance == null) { instance = this; } }
public void ExecuteAttack(CharacterManager attacker, CharacterManager defender) { if (!defender.isDead()) { double damage = GameLogicManager.CalculateDamage(attacker, defender); defender.ApplyDamage(damage); // check abilities that trigger on attack AbilityManager.CheckTriggeredAbilitiesActivation(TriggeredTriggerType.OnInflictedAttack, attacker, defender); AbilityManager.CheckTriggeredAbilitiesActivation(TriggeredTriggerType.OnReceivedAttack, defender, attacker); if (defender.isDead()) { // check abilities that trigger on death AbilityManager.CheckTriggeredAbilitiesActivation(TriggeredTriggerType.OnKill, attacker, defender); AbilityManager.CheckTriggeredAbilitiesActivation(TriggeredTriggerType.OnDeath, defender, attacker); // check again in case of resurrection if (defender.isDead()) { Kill(defender); } } if (defender.gameObject.CompareTag("Player")) { UpdateHealthBar(); } } }
/// <summary> /// Plugin initialization /// </summary> public void Initialize() { Debug.Log("Initializing Mod"); AbilityManager abilityManager = Manager.GetAbilityManager(); abilityManager.GetAbilityNamesAndIDs(out abilityIds, out abilityNames); Debug.Log("Number of Abilities: " + abilityIds.Length.ToString()); abilityManager.m_AbilityData.Add(new ModdedAbilityHijack.AbilityData(999)); var field = typeof(AbilityManager).GetField("__ALLAbilityData", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance); field.SetValue(abilityManager, null); abilityManager.GetAbilityNamesAndIDs(out abilityIds, out abilityNames); Debug.Log("Number of Abilities after Patch: " + abilityIds.Length.ToString()); string output = ""; for (int i = 0; i < abilityIds.Length; i++) { output += abilityIds[i] + ": " + abilityNames[i] + "\n"; } Debug.Log(output); // TODO log all ability data }
public void Use() { base.Use(); int id; if (OffenseBoost.Instance.isActive) { id = Random.Range(1, 4); } else if (DefenseBoost.Instance.isActive) { id = Random.Range(4, 7); } else { id = Random.Range(1, GemFactory.instance.MaxGemIndex); } Debug.Log("Collecting:" + id); for (int i = 0; i < Board.Size; i++) { for (int j = 0; j < Board.Size; j++) { if (Board.Instance.boardData[i, j] == id) { Board.Instance.board[i, j].Pop(); } } } AbilityManager.LaunchAbilities(); Board.Instance.FillBoard(); }
public PlayState(GameWindow Window, SpriteBatch spriteBatch, Character player, NetworkManager networkManager, PlayerManager playerManager) : base(Window) { this.spriteBatch = spriteBatch; if (player is Wizard) { this.player = (Wizard)player; } else if (player is Ogre) { this.player = (Ogre)player; } else if (player is Huntress) { this.player = (Huntress)player; } else if (player is Knight) { this.player = (Knight)player; } else if (player is TimeTraveler) { this.player = (TimeTraveler)player; } currentLevel = CreateNewLevel(); this.networkManager = networkManager; this.playerManager = playerManager; playerManager.ClientPlayer = player; playerManager.Level = currentLevel; abilityManager = new AbilityManager(networkManager, playerManager); userInterfaceManagerHealth = new UserInterfaceManagerHealth(Window, playerManager); }
void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); controller = GetComponent <Controller2D>(); animator = GetComponent <Animator>(); abilityManager = GetComponent <AbilityManager>(); gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); // This is some physics formula :) maxJumpVelocity = Mathf.Abs(gravity * timeToJumpApex); minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); controller.OnEnemyCollision += OnEnemyCollision; // TODO: Update enemies list on Update method but with Enumerator on every 1-2 seconds // TODO: We may not need to update the list on every frame but just to find the new closest enemy. // TODO: The update for the list entries must be done via message when new enemy dies or spawns. Enemies = GameObject.FindGameObjectsWithTag("Enemy").ToList(); foreach (GameObject enemy in Enemies) { Enemy enemyComponent = enemy.GetComponent <Enemy>(); enemyComponent.OnDeath += OnEnemyDeath; } //Currently not working.Find a way to fix this or use mouse targeting StartCoroutine(FindClosestEnemy()); }
void Start() { spriteRenderer = GetComponent<SpriteRenderer>(); controller = GetComponent<Controller2D>(); animator = GetComponent<Animator>(); abilityManager = GetComponent<AbilityManager>(); gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); // This is some physics formula :) maxJumpVelocity = Mathf.Abs(gravity * timeToJumpApex); minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); controller.OnEnemyCollision += OnEnemyCollision; controller.OnCollectableCollision += OnCollectableCollision; // TODO: Update enemies list on Update method but with Enumerator on every 1-2 seconds // TODO: We may not need to update the list on every frame but just to find the new closest enemy. // TODO: The update for the list entries must be done via message when new enemy dies or spawns. Enemies = GameObject.FindGameObjectsWithTag("Enemy").ToList(); foreach (GameObject enemy in Enemies) { Enemy enemyComponent = enemy.GetComponent<Enemy>(); enemyComponent.OnDeath += OnEnemyDeath; } // Currently not working. Find a way to fix this or use mouse targeting //StartCoroutine(FindClosestEnemy()); }
public void Setup() { _abilityManager = new AbilityManager(); _characterManager = new CharacterManager(@"E:\Dev\Kaerber.MUD\Assets", _abilityManager); _userManager = new UserManager(@"E:\Dev\Kaerber.MUD\Assets\players", _characterManager); UnityConfigurator.Configure(); }
void Update() { if (!initiated || !GameControl.EnableAbility()) { return; } if (singleButton) { Ability ability = AbilityManager.GetAbilityList()[AbilityManager.GetSelectID()]; buttonList[0].label.text = ability.currentCD <= 0 ? "" : ability.currentCD.ToString("f1") + "s"; buttonList[0].button.interactable = ability.IsReady() == "" ? true : false; } else { List <Ability> abilityList = AbilityManager.GetAbilityList(); for (int i = 0; i < buttonList.Count; i++) { //Debug.Log(i); buttonList[i].label.text = abilityList[i].currentCD <= 0 ? "" : abilityList[i].currentCD.ToString("f1") + "s"; buttonList[i].button.interactable = abilityList[i].IsReady() == "" ? true : false; } } }
protected override void Start() { //GameManager.RegisterEntity(this); stats = new StatCollection(statTemplate); Controller = GetComponent <Controller2D>(); MyAnimator = GetComponentInChildren <Animator>(); deckManager = GetComponentInChildren <AbilityDeckManager>(); deckManager.Initialize(this); inateAbiliites = GetComponentInChildren <AbilityManager>(); inateAbiliites.Initialize(this); inventory = GetComponentInChildren <Inventory>(); inventory.Initialize(); //AbilityManager2 = GetComponent<AbilityManager2>(); //AbilityManager2.Initialize(MyAnimator, controller); wallStickTimer = new Timer(wallStickTime, true, UnStickFromWall); gravity = -(2 * maxJumpheight) / Mathf.Pow(timeToJumpApex, 2); maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); }
IEnumerator DunkJump_C() { if (playerController) { playerController.DisableInput(); } passController.DisableBallReception(); ChangeState(DunkState.Jumping); pawnController.Freeze(); if ((int)AbilityManager.GetAbilityLevel(ConcernedAbility.Dunk) > 0) //If ability "Dunk" is upgraded { AttractEnemies(); } Vector3 i_startPosition = transform.position; Vector3 i_endPosition = i_startPosition + Vector3.up * dunkJumpHeight + transform.forward * dunkJumpLength; for (float i = 0; i < dunkJumpDuration; i += Time.deltaTime) { transform.position = Vector3.Lerp(i_startPosition, i_endPosition, i / dunkJumpDuration); yield return(new WaitForEndOfFrame()); } transform.position = i_endPosition; }
// public override Composite RestBehavior { get { return new ActionRunCoroutine(o => R.Rest.Rotation()); } } public override void Initialize() { try { this.MyCurrentSpec = Me.Specialization; HotKeyManager.RegisterHotKeys(); GlobalSettings.Instance.Init(); SettingsManager.Init(); AbilityManager.ReloadAbilities(); Log.Combat("--------------------------------------------------"); Log.Combat(Name); Log.Combat(string.Format("You are a Level {0} {1} {2}", Me.Level, Me.Race, Me.Class)); Log.Combat(string.Format("Current Specialization: {0}", this.MyCurrentSpec.ToString().Replace("Rogue", string.Empty))); Log.Combat(string.Format("Current Profile: {0}", GlobalSettings.Instance.LastUsedProfile)); Log.Combat(string.Format("{0} abilities loaded", AbilityManager.Instance.Abilities.Count)); Log.Combat("--------------------------------------------------"); HotKeyManager.RegisterHotKeys(); // DiminishingReturnManager.Instance.Init(); } catch (Exception ex) { Log.Gui(string.Format("Error Initializing Blade of the Assassin Combat Routine: {0}", ex)); } }
void Awake() { unitPathFinding = GetComponent <UnitPathFinding> (); buffer = GetComponent <ActionBuffer> (); aManager = GetComponent <AbilityManager> (); rangeState = RangeFromPlayer.OUTOFRANGE; }
/// <summary> /// Saves the game. /// </summary> public void SaveGame() { var save = new SaveGame(); if (HeroManager != null) { HeroManager.Save(ref save); } if (AbilityManager != null) { AbilityManager.Save(ref save); } if (RosterManager != null) { RosterManager.Save(ref save); } if (InventoryManager != null) { InventoryManager.Save(ref save); } if (WorldManager != null) { WorldManager.Save(ref save); } save.LastRewardTime = lastRewardTime; save.IsFilled = true; SaveGameManager.SaveGame(save); }
public override void Initialize() { try { MyCurrentSpec = Me.Specialization; GlobalSettingsManager.Instance.Init(); AbilityManager.ReloadAbilities(); AbilityChainsManager.Init(); ItemManager.LoadDataSet(); Events = new Events(); Log.Combat("--------------------------------------------------"); Log.Combat(Name); Log.Combat(string.Format("You are a Level {0} {1} {2}", Me.Level, Me.Race, Me.Class)); Log.Combat(string.Format("Current Specialization: {0}", MyCurrentSpec.ToString().Replace("Druid", string.Empty))); Log.Combat(string.Format("Current Profile: {0}", GlobalSettingsManager.Instance.LastUsedProfile)); Log.Combat(string.Format("{0} abilities loaded", AbilityManager.Instance.Abilities.Count)); Log.Combat(string.Format("{0} conditional use items loaded ({1} enabled)", ItemManager.Items.Count, ItemManager.Items.Count(o => o.Enabled))); Log.Combat("--------------------------------------------------"); AbilityChainsManager.LoadDataSet(); SettingsManager.Instance.LogDump(); } catch (Exception ex) { Log.Gui(string.Format("Error Initializing Paws Combat Routine: {0}", ex)); } }
// Use this for initialization void Start() { //denna ordningen är ganska viktig teamHandler = GameObject.FindGameObjectWithTag("TeamHandler").GetComponent <TeamHandler>(); selector = GameObject.FindGameObjectWithTag("PlayerHandler").GetComponent <Selector>(); builder = GameObject.FindGameObjectWithTag("PlayerHandler").GetComponent <Builder>(); enemyHandler = GameObject.FindGameObjectWithTag("EnemyHandler").GetComponent <EnemyHandler>(); abilityManager = GameObject.FindGameObjectWithTag("AbilityManager").GetComponent <AbilityManager>(); teamHandler.Init(); selector.Init(); builder.Init(); enemyHandler.Init(); abilityManager.Init(); Health[] healths = (Health[])FindObjectsOfType(typeof(Health)); for (int i = 0; i < healths.Length; i++) { healths[i].Init(); } AIBase[] aiBases = (AIBase[])FindObjectsOfType(typeof(AIBase)); for (int i = 0; i < aiBases.Length; i++) { aiBases[i].Init(); } UnitSpellHandler[] unitSH = (UnitSpellHandler[])FindObjectsOfType(typeof(UnitSpellHandler)); for (int i = 0; i < unitSH.Length; i++) { unitSH[i].Init(); } }
public AbilityManagerTest() { AbilityManager = new AbilityManager(); this.Engine.AddActor(AbilityManager); TurnManager = new TurnManager(); this.Engine.AddActor(TurnManager); }
public bool CanUse(AbilityManager manager) { if (Time.time > lastCalled + cooldown) { if (InRange(manager)) { if (cost <= manager.stats.stats.currentAP) { lastCalled = Time.time; Debug.Log(animationTrigger + " Performed"); return(true); } } else { Debug.Log(animationTrigger + " Out of range"); return(false); } } else { Debug.Log(animationTrigger + " on Cooldown"); } return(false); }
private void GetAbilityManager() { if (!abilityManager) { abilityManager = FindObjectOfType <Hero>().abilityManager; } }
public override void Start() { healthBar = UIManager.I.healthBar; energyBar = UIManager.I.energyBar; attributes = GameManager.I.attributes; health = baseHealth + baseHealth * GameManager.I.costHolder.GetStatAsMultiplier(AttributeType.HEALTH); base.Start(); facingDirection = Vector2.down; if (abilityManager == null) { abilityManager = GetComponentInChildren <AbilityManager>(); } speed = normalSpeed; soundController = GetComponent <SoundController>(); path = GetComponent <Pathfinding.AIPath>(); MoveToPosition((Vector2)transform.position + Vector2.down * 3); energyBar.BuildHealtBar(maxEnergy, false); StartCoroutine(energyBar.FillAmount(energy / maxEnergy, false)); }
void Start() { //ropeRender.enabled = true; //render.enabled = true; abiMan = GameObject.FindGameObjectWithTag("GameController").GetComponent <AbilityManager>(); }
// Use this for initialization public void Start () { //Debug.Log ("START FROM ABILITY"); caster = this.transform.parent.gameObject; //Debug.Log (caster); mouseS = GameObject.Find("Main Camera").GetComponent<Mouse> (); aMan = GameObject.Find("AbilityManager").GetComponent<AbilityManager> (); guiScript = GameObject.Find ("SpawnGUI").GetComponent<UserInterfaceGUI> (); }
public override void Use() { am = GameObject.FindObjectOfType<AbilityManager>(); White = am.White; //Get a list of all ninja monkeys on the field who haven't used their effect NinjaMonkeys = GameObject.FindObjectsOfType<TowerScript>().Where(n => n.TowerType == TowerType.Ted).Where(n => !n.EffectUsed); am.JohnCena(); am.StartACoroutine(ShakeCamera()); am.StartACoroutine(Run()); }
/// <summary> /// Contrutor sem parametro /// </summary> public RPGCustomCharacter() { this.name = ""; this.typeClass = new Class(); this.level = new ExperienceLevel(); this.life = new Life(); this.damage = new Damage(); this.armor = new Armor(); this.attributes = new Attributes(); this.inventory = new Inventory(); this.abilityManager = new AbilityManager(); this.effects = new List<Effect>(); this.level = new ExperienceLevel(); }
//handle progression of entity, attributes, and resources public void Awake() { attr = new FloatRange(0); attr.SetModifier("Mod1", FloatModifier.Value(1)); attr.SetModifier("Mod2", FloatModifier.Value(3)); attr.SetModifier("Mod3", FloatModifier.Value(6)); attr2 = new FloatRange(0); attr2.SetModifier("Mod1", FloatModifier.Value(5)); attr2.SetModifier("Mod2", FloatModifier.Percent(0.2f)); attr2.SetModifier("Mod3", FloatModifier.Value(5)); resourceManager = new ResourceManager(this); statusManager = new StatusEffectManager(this); abilityManager = new AbilityManager(this); emitter = new EventEmitter(); EntityManager.Instance.Register(this); //gameObject.layer = LayerMask.NameToLayer("Entity"); }
//TO DO //double click/control click for selection of all units of same type. // Update is called once per frame void Update () { if(!AbilityManagerFound){ FindAbilityManager = GameObject.Find("AbilityManager"); if(FindAbilityManager != null){ aMan = GameObject.Find("AbilityManager").GetComponent<AbilityManager> (); } } if(FindAbilityManager){ if (aMan.isTargetingAbility) { return; } if (Input.GetMouseButtonDown (0)) { startClick = Input.mousePosition; if(GUIUtility.hotControl == 0){ //Check if there is a GUI Element under the mouse. If not, continue with the Raycasting. Vector3 mPos = Camera.main.ScreenToWorldPoint (Input.mousePosition); RaycastHit hit; if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 100f)) { //check if anything is hit. LayerMask layermaskB = (1 << 10); LayerMask layermaskU = (1 << 12); if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 100f, layermaskB)) { //check if it is a building that was clicked on //Debug.Log ("CLICKED ON BUILDING " + hit.transform.name); if (!ShiftKeyDown ()){ //allowing multiple units and buildings to be selected if shift is held. And deselects other things if shift is not held. ClearBuildingSelections (); ClearUnitSelections(); } Building buildingScript = hit.transform.GetComponent<Building> (); if(ShiftKeyDown() && buildingsSelected.Count > 0 && buildingScript.isSelected){ //if shift, and the building is already selected, deselect it RemoveBuildingSelection(buildingScript); } else{ AddBuildingSelection(buildingScript); //otherwise, select it } } else if(Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 100f, layermaskU)){//check if it is a unit that was clicked on //Debug.Log ("CLICKED ON UNIT " + hit.transform.name); if (!ShiftKeyDown ()){ //allowing multiple units and buildings to be selected if shift is held. ClearBuildingSelections (); ClearUnitSelections(); } Unit unitScript = hit.transform.GetComponent<Unit> (); //if so, say it is selected. if(ShiftKeyDown() && unitsSelected.Count > 0 && unitScript.isSelected){ //if shift, and the building is already selected, deselect it RemoveUnitSelection(unitScript); } else{ AddUnitSelection(unitScript); //otherwise, select it } } else { //if nothing was clicked on. Deselect everything. if(!ShiftKeyDown()) { ClearBuildingSelections (); ClearUnitSelections(); } } } } } else if(Input.GetMouseButtonUp(0)){ //resetting selection rectangle if mousebutton is released startClick = -Vector3.one; } if (Input.GetMouseButton (0)) { //Creating selection rectangle selection = new Rect(startClick.x, InvertMouseY(startClick.y),Input.mousePosition.x - startClick.x, InvertMouseY(Input.mousePosition.y) - InvertMouseY(startClick.y)); if(selection.width < 0){ selection.x += selection.width; selection.width = -selection.width; } if(selection.height < 0){ selection.y += selection.height; selection.height = -selection.height; } } if (Input.GetMouseButtonDown (1)) { //If right click if(buildingsSelected.Count > 0){ foreach(Building b in buildingsSelected){ if(b.isUnitBuilding){ Vector3 temp = Camera.main.ScreenToWorldPoint (Input.mousePosition); temp.z = -1; b.SetWaypoint(temp); } } } } } } //end Update
void Start() { _currentSource = 0.0f; _refreshDarkness = false; _refreshTimer = 5.0f; _playerMovement = GetComponent<PlayerMovement>(); _abilityManager = GetComponent<AbilityManager>(); _playerHealth = GetComponent<Health>(); }
public void Awake() { inventory = new Inventory(); // LoadInventory(); abilityManager = gameObject.GetComponent<AbilityManager>(); equippedEquip = new Dictionary<equipSlots.slots, equipment>(); _soundManager = GetComponent<EntitySoundManager>(); equipAtt = new Attributes(); buffAtt = new Attributes(); baseAtt = new Attributes(); baseAtt.Health = currentHP = 100; baseAtt.Resource = currentResource = 100; baseAtt.Power = 10; baseAtt.Defense = 10; baseAtt.AttackSpeed = 0; baseAtt.MovementSpeed = 1.0f; level = 1; experience = 0; }
private AbilityManager manager; // Get the AbilityManager script to keep track of current ability void Start () { shield.SetActive(false); manager = GetComponent<AbilityManager>(); }
// Use this for initialization void Start() { engmodel = Engine.EngineModel; //Start turn manager TurnManager turnManager = new TurnManager(); engmodel.AddActor(turnManager); AbilityManager abilityManager = new AbilityManager(); engmodel.AddActor(abilityManager); engmodel.EventManager.Register(new Trigger<PlayerJoinedEvent>(OnPlayerJoin)); Player[] players = Settings.LocalPlayers; foreach (Player p in players) { engmodel.ActionManager.Queue(new PlayerJoinAction(p)); } }
// Use this for initialization void Start() { gameplay = this; _MainCamera = (Camera)gameObject.GetComponent("Camera"); _SelectionListWindow = new SelectionListWindow(Screen.width / 2, Screen.height / 2 + 100); _AbilityManagerList = new SelectionListGenericWindow(Screen.width / 2, Screen.height / 2 + 100); _SelectionCardNameWindow = new SelectionCardNameWindow(Screen.width / 2 - 50, Screen.height / 2); _SelectionCardNameWindow.CreateCardList(); _SelectionCardNameWindow.SetGame(this); _DecisionWindow = new DecisionWindow(Screen.width / 2, Screen.height / 2 + 100); _DecisionWindow.SetGame(this); _NotificationWindow = new NotificacionWindow(Screen.width / 2, Screen.height / 2 + 100); _NotificationWindow.SetGame(this); FromHandToBindList = new List<Card>(); AttackedList = new List<Card>(); UnitsCalled = new List<Card>(); EnemySoulBlastQueue = new List<Card>(); _PopupNumber = new PopupNumber(); _MouseHelper = new MouseHelper(this); GameChat = new Chat(); opponent = PlayerVariables.opponent; playerHand = new PlayerHand(); enemyHand = new EnemyHand(); field = new Field(this); enemyField = new EnemyField(this); guardZone = new GuardZone(); guardZone.SetField(field); guardZone.SetEnemyField(enemyField); guardZone.SetGame(this); fieldInfo = new FieldInformation(); EnemyFieldInfo = new EnemyFieldInformation(); Data = new CardDataBase(); List<CardInformation> tmpList = Data.GetAllCards(); for(int i = 0; i < tmpList.Count; i++) { _SelectionCardNameWindow.AddNewNameToTheList(tmpList[i]); } //camera = (CameraPosition)GameObject.FindGameObjectWithTag("MainCamera").GetComponent("CameraPosition"); //camera.SetLocation(CameraLocation.Hand); LoadPlayerDeck(); LoadEnemyDeck(); gamePhase = GamePhase.CHOOSE_VANGUARD; bDrawing = true; bIsCardSelectedFromHand = false; bPlayerTurn = false; bDriveAnimation = false; bChooseTriggerEffects = false; DriveCard = null; //Texture showed above a card when this is selected for an action (An attack, for instance) CardSelector = GameObject.FindGameObjectWithTag("CardSelector"); _CardMenuHelper = (CardHelpMenu)GameObject.FindGameObjectWithTag("CardMenuHelper").GetComponent("CardHelpMenu"); _GameHelper = (GameHelper)GameObject.FindGameObjectWithTag("GameHelper").GetComponent("GameHelper"); bPlayerTurn = PlayerVariables.bFirstTurn; //ActivePopUpQuestion(playerDeck.DrawCard()); _CardMenu = new CardMenu(this); _AbilityManager = new AbilityManager(this); _AbilityManagerExt = new AbilityManagerExt(); _GameHelper.SetChat(GameChat); _GameHelper.SetGame(this); EnemyTurnStackedCards = new List<Card>(); dummyUnitObject = new UnitObject(); dummyUnitObject.SetGame(this); stateDynamicText = new DynamicText(); }
void Start(){ manager = GetComponent<AbilityManager>(); controller = GetComponent<FirstPersonController>(); player = Player.Instance; }
public GameObject whip; // For testing I'm using a box collider void Start(){ manager = GetComponent<AbilityManager>(); }
void Awake() { SetupMachine(PursuitStates.inactive); HashSet<Enum> inactiveTransitions = new HashSet<Enum>(); inactiveTransitions.Add(PursuitStates.approach); AddTransitionsFrom(PursuitStates.inactive, inactiveTransitions); AddAllTransitionsTo(PursuitStates.inactive); HashSet<Enum> approachTransitions = new HashSet<Enum>(); approachTransitions.Add(PursuitStates.seek); approachTransitions.Add(PursuitStates.flee); AddTransitionsFrom(PursuitStates.approach, approachTransitions); AddAllTransitionsFrom(PursuitStates.seek); HashSet<Enum> attackTransitions = new HashSet<Enum>(); attackTransitions.Add(PursuitStates.seek); attackTransitions.Add(PursuitStates.flee); AddTransitionsFrom(PursuitStates.attack, attackTransitions); HashSet<Enum> fleeTransitions = new HashSet<Enum>(); fleeTransitions.Add(PursuitStates.approach); fleeTransitions.Add(PursuitStates.inactive); fleeTransitions.Add(PursuitStates.flee); AddTransitionsFrom(PursuitStates.flee, fleeTransitions); StartMachine(PursuitStates.inactive); hasFled = false; doesFlee = true; _swinging = false; entity = GetComponent<Entity>(); MoveFSM = GetComponent<MovementFSM>(); combatFSM = GetComponent<CombatFSM>(); _abilityManager = GetComponent<AbilityManager>(); _animationController = GetComponent<AnimationController>(); _soundManager = GetComponent<EntitySoundManager>(); _collider = GetComponent<CapsuleCollider>(); }
// Use this for initialization void Start() { actionFlags = 0; prevActionFlags = 0; abilityManager = gameObject.GetComponent<AbilityManager>(); }
/// <summary> /// Gets the abilities and enemy generator items in the hiarchy and updates the store /// </summary> void Start() { abilityManager = GameObject.FindObjectOfType<AbilityManager>(); enemyGenerator = GameObject.FindObjectOfType<EnemyGenerator>(); UpdateStore(); }