// Start is called before the first frame update void Start() { rb = this.GetComponent <Rigidbody>(); fightScript = GameObject.Find("arena1").transform.GetChild(0).transform.gameObject.GetComponent <FightManager>(); rbAttackConstraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX; rbHitConstraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY; }
void OnEnable() { rigid = GetComponent <Rigidbody>(); contact = GetComponent <GroundContact>(); area = FindObjectOfType <FightArea>(); manager = FindObjectOfType <FightManager>(); }
void OnDestroy() { if (this == FightManager.instance) { FightManager.instance = null; } }
void OnLevelWasLoaded(int level) { if(level == 1) { if (playing != 0) { playing = 0; source.loop = false; source.clip = menu; source.Play(); } } if (level == 3) { try { print("trying"); bossFight = GameObject.Find("Boss").GetComponent<FightManager>(); print(true); } catch { } } }
// Use this for initialization void Start() { if (instance != null) { Debug.LogError("Error: Two FIghtManagers were created"); return; } instance = this; CreatePlayers(); if (player1 == null || player2 == null) { Debug.LogError("Error: Both players were not set"); return; } foreach (Image im in doubleUpImages) { im.enabled = false; FlickerImage flicker = im.GetComponent <FlickerImage> (); if (flicker != null) { flicker.Disable(); } } SetNextDoubleTime(); isDoubleTime = false; BeginRound(); }
private void OnBtnPlayClick() { List <BaseSoldier> soldiers = new List <BaseSoldier>(); for (int i = 0; i < _hiredSoldiers.Length; i++) { if (_hiredSoldiers[i] >= 0) { soldiers.Add(new BaseSoldier(_availableSoldiers[_hiredSoldiers[i]], Global.Instance.Player.City.GetSoldierUpgradesInfo(_availableSoldiers[_hiredSoldiers[i]].Key).Level)); } } Global.Instance.CurrentMission.SelectedSoldiers = new ArrayRO <BaseSoldier>(soldiers.ToArray()); //setup random units and map EUnitKey[] availableUnits = new EUnitKey[] { EUnitKey.Scout, EUnitKey.Trooper, EUnitKey.Jawa_1 }; string[] availableMaps = new string[] { "battle1_forest_1", "battle1_forest_2" }; EUnitKey[] units = new EUnitKey[Random.Range(1, 6)]; units[0] = EUnitKey.Hero_Sniper; for (int i = 1; i < units.Length; i++) { units[i] = availableUnits[Random.Range(0, availableUnits.Length)]; } MissionMapData mmd = new MissionMapData(units, availableMaps[Random.Range(0, availableMaps.Length)]); MissionData md = new MissionData(EMissionKey.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, new MissionMapData[] { mmd }); FightManager.Setup(EFightMode.PvP, md); LoadingScreen.Instance.Show(); LoadingScreen.Instance.SetProgress(0f); Application.LoadLevel("Fight"); }
public void Awake() { towerFinishedEvent = new UnityEvent(); fm = FindObjectOfType <FightManager>(); enemySpawner = FindObjectOfType <EnemySpawner>(); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); roomGenerator = GetComponent <RoomGenerator>(); levelGenerator = GetComponent <LevelGenerator>(); mapController = GetComponent <MapController>(); fightManager = GetComponent <FightManager>(); gearManager = GetComponent <GearManager>(); statManager = GetComponent <StatManager>(); InitGame(); }
private void Start() { InventoryManager.onInventoryChange += OnInventoryChange; fightManager = GameObject.Find("GameManager").GetComponent <FightManager>(); inventoryManager = GameObject.Find("GameManager").GetComponent <InventoryManager>(); UpdateText(); }
void Awake() { group = GroupType.Mine; FightManager.GetInstance().mineGroup = this; heroDataDic = Util.GetDic <MsgHeroData, HeroData>(); heroEvolution = Util.GetDic <MsgHeroEvolution, HeroEvolution>(); }
public CPlayerInstance(FightManager fightManager, Region region, PlayerKnownList objectKnownList, StatHolder stats, IItemHolder items, EffectHolder effects, IEnumerable <ICharacterData> characterDatas) : base(region, objectKnownList, stats, items, effects, characterDatas) { Destination = new Position(); FightManager = fightManager; }
public override void TakeDamage(float damage, string attackerID) { base.TakeDamage(damage, attackerID); currentHp -= damage; StopCoroutine("ToRed"); StartCoroutine("ToRed"); if (currentHp <= 0) { Debug.Log("Die"); bomb.SetActive(true); bomb.transform.position = transform.position += new Vector3(0, 1, 0); AudioManager.GetInstance().PlaySound(4); GameMgr.instance.TurnToAngel(attackerID, GetComponent <AngleControl>().id); FightManager.GetInstance().ToGhost(GetComponent <AngleControl>().id); FightManager.GetInstance().ToAngle(attackerID); currentHp = maxHp; } if (HpSlider) { HpSlider.value = currentHp; } else { Debug.LogError("No Slider"); } //splashTimer = Time.time; //splashTime = Time.time; }
void Awake() { instance = this; //needEnergy = 10; needEnergy = Random.Range(Const.CONST_SPECIALSKILL_RNDMIN, Const.CONST_SPECIALSKILL_RNDMAX); DecisionFactorDic = Util.GetDic <MsgDecisionFactor, DecisionFactor>(); }
FightManager() { if (i == null) { i = this; } }
static int InitMap(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(FightManager))) { FightManager obj = (FightManager)ToLua.ToObject(L, 1); obj.InitMap(); return(0); } else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(FightManager), typeof(int[][]), typeof(int[][]))) { FightManager obj = (FightManager)ToLua.ToObject(L, 1); int[][] arg0 = ToLua.CheckObjectArray <int[]>(L, 2); int[][] arg1 = ToLua.CheckObjectArray <int[]>(L, 3); obj.InitMap(arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: FightManager.InitMap")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void SetUpGame() { GameRandom = new System.Random(); RealDate = new Date(); RealDate.Day = 1; RealDate.Month = 1; RealDate.Year = 1; FightManager = new FightManager(); ActivityManager = new ActivityManager(); CurrentLeagueFighterDatabase = new FighterDatabase(); TeamManager = new TeamManager(); BookingManager = new BookingManager(); PlayerManager = new PlayerManager(); CharacterDatabase = new CharacterDatabase(); WorldMethods.SetUpWorld(); GameObject.Find("FighterListContent").GetComponent <FighterListContent> ().SetUp(CurrentLeagueFighterDatabase.AllFighters); GameObject.Find("TeamListContent").GetComponent <TeamListContent> ().SetUp(TeamManager.TeamsInLeague); GameObject.Find("FightsPlannedListContent").GetComponent <FightPlanListContent> ().SetUp(BookingManager.Calendar); CharacterDatabase.SetUpCharacterDatabase(); //Check whether the ID assignment has occurred properly print("Total Characters: " + CharacterDatabase.AllCharacters.Count); print("Highest ID: " + CharacterDatabase.UsedIDs + " (Should be the same as Total Characters)"); OpinionManager = new Opinion(); }
public void CheckForVictory1v1(Character f1, Character f2) { if (f1.CurrentHealth <= 0) { if (PlayerWatchingFight) { fightPanel.UpdateTextLog(f1.FirstName + " " + f1.LastName + " is down!"); fightPanel.UpdateTextLog(f2.FirstName + " has " + f2.CurrentHealth + " health left."); fightPanel.UpdateTextLog(f2.FirstName + " " + f2.LastName + " wins!"); } f2.GainExperience(500); f1.GainExperience(250); FightManager.PayOut(Audience, f2, f1, false); FightOver = true; FightPlanButton.GetComponent <FightPlanListButton> ().FightHasBeen(f2); } else if (f2.CurrentHealth <= 0) { if (PlayerWatchingFight) { fightPanel.UpdateTextLog(f2.FirstName + " " + f2.LastName + " is down!"); fightPanel.UpdateTextLog(f1.FirstName + " has " + f1.CurrentHealth + " health left."); fightPanel.UpdateTextLog(f1.FirstName + " " + f1.LastName + " wins!"); } f1.GainExperience(500); f2.GainExperience(250); FightManager.PayOut(Audience, f1, f2, false); FightOver = true; FightPlanButton.GetComponent <FightPlanListButton> ().FightHasBeen(f1); } }
public void Run(object threadContext) { Stopwatch timer = new Stopwatch(); timer.Start(); isRunning = true; while (isRunning) { try { //UPDATE_SPEED is the time that has to pass in order to run the thread process if (timer.Elapsed < TimeSpan.FromMilliseconds((double)UPDATE_SPEED)) { if (FightManager.getAllFightsCount() <= 0) { Thread.Sleep(1000); timer.Restart(); } if (UPDATE_SPEED - timer.Elapsed.Milliseconds > 0) { Thread.Sleep(UPDATE_SPEED - timer.Elapsed.Milliseconds); } continue; } var updateTime = timer.Elapsed; timer.Restart(); Update(updateTime); //process } catch (Exception e) { Log.ErrorFormat(string.Format("Exception happened in {0} - {1}", CLASSNAME, e.StackTrace)); } } }
static int SetHealthChangeAction(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FightManager obj = (FightManager)ToLua.CheckObject(L, 1, typeof(FightManager)); System.Action <FightManager.HealthChangePacker> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action <FightManager.HealthChangePacker>)ToLua.CheckObject(L, 2, typeof(System.Action <FightManager.HealthChangePacker>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <FightManager.HealthChangePacker>), func) as System.Action <FightManager.HealthChangePacker>; } obj.SetHealthChangeAction(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SetMemberDeadAction(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FightManager obj = (FightManager)ToLua.CheckObject(L, 1, typeof(FightManager)); System.Action <UnityEngine.GameObject, int, FightManager.MemberType> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action <UnityEngine.GameObject, int, FightManager.MemberType>)ToLua.CheckObject(L, 2, typeof(System.Action <UnityEngine.GameObject, int, FightManager.MemberType>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.GameObject, int, FightManager.MemberType>), func) as System.Action <UnityEngine.GameObject, int, FightManager.MemberType>; } obj.SetMemberDeadAction(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 取得某个坐标附近的单位(指定阵营或全阵营) /// </summary> public static List <FightUnit> GetPosNearby(Vector3 pos, float range, FightGroup targetGroup) { List <FightUnit> targets = new List <FightUnit>(); if (targetGroup != null) { for (int i = 0; i < targetGroup.fightUnits.Count; i++) { if (Util.Distance(pos, targetGroup.fightUnits[i].transform.localPosition) <= range) { targets.Add(targetGroup.fightUnits[i]); } } } else { for (int i = 0; i < FightManager.GetInstance().mineGroup.fightUnits.Count; i++) { if (Util.Distance(pos, FightManager.GetInstance().mineGroup.fightUnits[i].transform.localPosition) <= range) { targets.Add(FightManager.GetInstance().mineGroup.fightUnits[i]); } } for (int i = 0; i < FightManager.GetInstance().enemyGroup.fightUnits.Count; i++) { if (Util.Distance(pos, FightManager.GetInstance().enemyGroup.fightUnits[i].transform.localPosition) <= range) { targets.Add(FightManager.GetInstance().enemyGroup.fightUnits[i]); } } } return(targets); }
private void StartFight() { PlayerResources playerResources = Global.Instance.Player.Resources; MissionData md = MissionsConfig.Instance.GetPlanet(EPlanetKey.PlanetA).GetMission(EMissionKey.PlanetA_Test1); if (playerResources.Fuel < md.FuelWinCost || playerResources.Fuel < md.FuelLoseCost || playerResources.Credits < md.CreditsWinCost || playerResources.Credits < md.CreditsLoseCost || playerResources.Minerals < md.MineralsWinCost || playerResources.Minerals < md.MineralsLoseCost) { Debug.LogWarning("Not enough resources"); return; } BaseSoldier[] soldiers = new BaseSoldier[_hiredUnits.Count]; for (int i = 0; i < soldiers.Length; i++) { soldiers[i] = new BaseSoldier(UnitsConfig.Instance.GetSoldierData(_hiredUnits[i]), Global.Instance.Player.City.GetSoldierUpgradesInfo(_hiredUnits[i]).Level); } Global.Instance.CurrentMission.PlanetKey = EPlanetKey.PlanetA; Global.Instance.CurrentMission.MissionKey = EMissionKey.PlanetA_Test1; Global.Instance.CurrentMission.SelectedSoldiers = new ArrayRO <BaseSoldier>(soldiers); FightManager.Setup(EFightMode.Campaign, MissionsConfig.Instance.GetPlanet(Global.Instance.CurrentMission.PlanetKey).GetMission(Global.Instance.CurrentMission.MissionKey)); Application.LoadLevel("Fight"); }
void Update() { UpdateHeadShot(); UpdateEnergy(); //按左走或者 按右走 if (isLPress) { FightManager.GetInstance().MoveBack(); } else if (isRPress) { FightManager.GetInstance().MoveForward(); } //摄像机运动 FightManager.GetInstance().CaculateCinemaParameter(); FightManager.GetInstance().CinemaMoveBack(); FightManager.GetInstance().CinemaMoveToward(); //战斗背景移动 // ScrollSceneManager.instance.CaculateBackgroundParameter (); // ScrollSceneManager.instance.BackGroundMoveBack (); // ScrollSceneManager.instance.BackGroundMoveToward (); }
// called when we get to the shogun panel void InitShogunPanel() { Skinning.ResetSkin(selectedSkin); if (shogunManager == null) { Debug.LogError(debuguableInterface.debugLabel + "ShogunManager component shouldn't be null. If we can't get scene references we can't do anything."); return; } EnemyBundle bundle = gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }); GeneralDialogue selectedGeneral = bundle.shogunDialogue; selectedGeneral.Init(); CombatDialogue selectedCombat = bundle.combatDialogue; shogunManager.Init(useCheats, () => { popupManager.Pop(GamePopup.SHOGUN_DEDUCTION); audioProjectManager.FadeMusicOut(); }, audioProjectManager.FadePopupMusicIn); popupManager.GetPopupFromType <ShogunPopup>().SpecificInit( useCheats, selectedGeneral.GetAllClues(), selectedGeneral.unlockableConclusions, shogunManager.characters, selectedGeneral.goodDeityFeedback, selectedGeneral.badDeityFeedback, () => { popupManager.CancelPop(); audioProjectManager.FadeMusicIn(); }, () => { audioProjectManager.FadeMusicOut(); audioProjectManager.FadePopupMusicOut(); panelManager.JumpTo(GamePhase.FIGHT, () => { fightManager = FindObjectOfType <FightManager>(); fightManager.PreInit(selectedCombat); audioProjectManager.FadeMusicOut(); }); }, selectedCombat.actualState ); if (selectedCombat.actualState == GameState.NORMAL) { gameData.ResetPlayerClues(); } actualTutorial.Init(() => shogunManager.StartDialogue(selectedGeneral)); }
void Start() { Player = GameObject.Find("Player"); FightManag = GameObject.Find("FightManager").GetComponent <FightManager>(); //Enemy = GameObject.Find("Enemy"); timeBetweenKremowka = 1f; timestamp = Time.time; }
public static FightManager getInstance() { if(instance == null) { instance = new FightManager(); } return instance; }
void InitConsequencesPanel() { Skinning.ResetSkin(selectedSkin); if (consequencesManager == null) { Debug.LogError(debuguableInterface.debugLabel + "ConsequencesManager component shouldn't be null. If we can't get scene references we can't do anything."); } EnemyBundle bundle = gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }); CombatDialogue selectedCombat = bundle.combatDialogue; string textToShow = string.Empty; switch (selectedCombat.actualState) { case GameData.GameState.GAME_OVER_GENERAL: textToShow = bundle.combatDialogue.playerLoseGeneralConsequence; break; case GameData.GameState.GAME_OVER_FINISHER: textToShow = bundle.combatDialogue.playerLoseFinalConsequence; break; default: textToShow = bundle.combatDialogue.playerWinConsequence; break; } consequencesManager.Init( selectedCombat.actualState, (int)actualEnemy, () => panelManager.JumpTo(GamePhase.END, () => { endManager = FindObjectOfType <EndManager>(); audioProjectManager.FadeMusicOut(); }), () => panelManager.JumpTo(GamePhase.SHOGUN, () => { shogunManager = FindObjectOfType <ShogunManager>(); shogunManager.PreInit( selectedCombat.actualState, gameData.enemyContent.Find(item => { return(item.enemy == actualEnemy); }).shogunDialogue, AddClueToPlayer ); audioProjectManager.FadeMusicOut(); }), () => panelManager.JumpTo(GamePhase.FIGHT, () => { fightManager = FindObjectOfType <FightManager>(); fightManager.PreInit(selectedCombat); audioProjectManager.FadeMusicOut(); }), () => actualEnemy++, textToShow ); }
public void Awake() { _sceneInstance = this; EventsAggregator.Units.AddListener <BaseUnitBehaviour>(EUnitEvent.ReadyToFight, OnUnitReadyToFight); EventsAggregator.Fight.AddListener <BaseUnitBehaviour, BaseUnitBehaviour>(EFightEvent.PerformAttack, OnUnitAttack); EventsAggregator.Fight.AddListener <BaseUnit>(EFightEvent.AllyDeath, OnAllyDeath); EventsAggregator.Fight.AddListener <BaseUnit>(EFightEvent.EnemyDeath, OnEnemyDeath); }
// Start is called before the first frame update void Start() { Application.targetFrameRate = 60; Time.timeScale = 1; dummy = GameObject.Find("dummy"); drag1 = GameObject.Find("Canvas").transform.GetChild(0).GetComponent <Drag>(); fadeAnim = GameObject.Find("Canvas").transform.GetChild(1).gameObject.GetComponent <Animator>(); fightScript = GameObject.Find("arena1").transform.GetChild(0).transform.gameObject.GetComponent <FightManager>(); }
private void Awake() { //A classe encontra o objeto do tipo FightManager e atribui à variável devida. fightManagerScript = GameObject.FindObjectOfType <FightManager>(); if (fightManagerScript == null) { Debug.LogWarning("FightManager não encontrado."); } }
private void Awake() { instance = this; player.entity = EntityMotor.Entity.player; player.enemy = enemy; enemy.entity = EntityMotor.Entity.enemy; enemy.enemy = player; }
private void Start() { CurrentHealth = MaxHealth; slider.maxValue = MaxHealth; slider.value = CurrentHealth; fightManager = GameObject.Find("GameManager").GetComponent <FightManager>(); animator = GetComponent <Animator>(); rigidbody = GetComponent <Rigidbody>(); audioManager = GameObject.Find("GameManager").GetComponent <AudioManager>(); }
void Start() { InitTriggers(); netView = PLAYER.gameObject.GetComponent<NetworkView>(); fManager = FightManager.Instance; #region Public Settings Init oldHP = HP = StartHP = Personage.GetHP(PersonageID); SPEED = Personage.GetSPEED(PersonageID); STRENGTH = Personage.GetSTRENGTH(PersonageID); IS_MINE = netView.isMine; //Найти правого игрока if ((Network.isClient&&netView.isMine)||(Network.isServer&&!netView.isMine)) { SIDE = -1; fManager.Client = this; }else {fManager.Server = this;} PLAYER.localScale = new Vector3((float)SIDE,1,1);//повернуть игрока в нужную сторону #endregion newPosition = PLAYER.transform.position; }
public void Awake() { FightManager.instance = this; }
public void Awake() { _sceneInstance = this; EventsAggregator.Units.AddListener<BaseUnitBehaviour>(EUnitEvent.ReadyToFight, OnUnitReadyToFight); EventsAggregator.Fight.AddListener<BaseUnitBehaviour, BaseUnitBehaviour>(EFightEvent.PerformAttack, OnUnitAttack); EventsAggregator.Fight.AddListener<BaseUnit>(EFightEvent.AllyDeath, OnAllyDeath); EventsAggregator.Fight.AddListener<BaseUnit>(EFightEvent.EnemyDeath, OnEnemyDeath); }
void Start() { _instance = this; Connector.IS_SCENE_LOADED = true; InitRects(); }