private void Update() { if (getAtkMgr == true) { s_Enemy = SocketServer.SingleTonServ().NowEnemyScript(); atkMgr = s_Enemy.gameObject.GetComponent <AttackMgr>(); } }
void Start() { playerAniCon = GetComponent <AnimationController>(); playerRigidBody = GetComponent <Rigidbody>(); custom = GetComponent <HeroCustomize>(); custom.IndexWeapon.CurrentType = weaponNum; playerAniCon.weaponIndex = weaponNum; animation = GetComponent <Animation>(); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); enemyAtk = enemyObj.GetComponent <AttackMgr>(); }
IEnumerator MoveDelay() //0.031초마다 플레이어의 위치, 회전을 상대 유저에게 보냄 { yield return(new WaitForSeconds(0.31f)); enemyObj = spawnInfo.nowEnemy; enemyAtk = enemyObj.GetComponent <AttackMgr>(); enemyAtk.playerWeapon = weaponNum; while (true) { Vector3 pos = transform.position; Quaternion rot = transform.rotation; sMove move = new sMove(pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, rot.w); SocketServer.SingleTonServ().SendMsg(move); yield return(new WaitForSeconds(0.031f)); } }
private void Update() { if (getAtkMgr == true) { s_Enemy = SocketServer.SingleTonServ().NowEnemyScript(); if (s_Enemy != null) { atkMgr = s_Enemy.gameObject.GetComponent <AttackMgr>(); } } if (effStart) { effStart = false; particle.Play(); StartCoroutine(Delay()); } }
protected virtual void Awake() { Time.timeScale = 1.0f; //unfreeze game if it was frozen from a previous game. Initialized = false; //faction stats are not ready, yet //Get components: CamMgr = FindObjectOfType(typeof(CameraController)) as CameraController; //Find the camera movement script. ResourceMgr = FindObjectOfType(typeof(ResourceManager)) as ResourceManager; //Find the resource manager script. BuildingMgr = FindObjectOfType(typeof(BuildingManager)) as BuildingManager; TaskMgr = FindObjectOfType(typeof(TaskManager)) as TaskManager; UnitMgr = FindObjectOfType(typeof(UnitManager)) as UnitManager; SelectionMgr = FindObjectOfType(typeof(SelectionManager)) as SelectionManager; GroupSelection = FindObjectOfType(typeof(UnitGroupSelection)) as UnitGroupSelection; PlacementMgr = FindObjectOfType(typeof(BuildingPlacement)) as BuildingPlacement; TerrainMgr = FindObjectOfType(typeof(TerrainManager)) as TerrainManager; MvtMgr = FindObjectOfType(typeof(MovementManager)) as MovementManager; UIMgr = FindObjectOfType(typeof(UIManager)) as UIManager; //Find the UI manager script. ErrorMessageMgr = FindObjectOfType(typeof(ErrorMessageHandler)) as ErrorMessageHandler; MinimapIconMgr = FindObjectOfType(typeof(MinimapIconManager)) as MinimapIconManager; AttackWarningMgr = FindObjectOfType(typeof(AttackWarningManager)) as AttackWarningManager; AttackMgr = FindObjectOfType(typeof(AttackManager)) as AttackManager; EffectPool = FindObjectOfType(typeof(EffectObjPool)) as EffectObjPool; UpgradeMgr = FindObjectOfType(typeof(UpgradeManager)) as UpgradeManager; InputMgr = FindObjectOfType(typeof(InputManager)) as InputManager; #if RTSENGINE_FOW FoWMgr = FindObjectOfType(typeof(FogOfWarRTSManager)) as FogOfWarRTSManager; #endif #if RTSENGINE_FOW if (FoWMgr) //only if there's a fog of war manager in the scene { FoWMgr.Init(this); } #endif CamMgr.Init(this); MinimapIconMgr?.Init(this); MvtMgr.Init(this); TaskMgr.Init(this); SelectionMgr.Init(this); GroupSelection.Init(this); PlacementMgr.Init(this); TerrainMgr.Init(this); UIMgr.Init(this); //initialize the UI manager. ErrorMessageMgr.Init(this); AttackWarningMgr?.Init(this); AttackMgr.Init(this); EffectPool.Init(this); UpgradeMgr.Init(this); ResourceMgr.Init(this); BuildingMgr.Init(this); UnitMgr.Init(this); InputMgr.Init(this); MultiplayerGame = false; //We start by assuming it's a single player game. if (!InitMultiplayerGame() && !InitSinglePlayerGame()) //if it's not neither a multiplayer nor a single player game { InitFactions(); //we're starting the game directly from the editor in the map scene, init factions directly } ResourceMgr.InitFactionResources(); //init resources for factions. InitCampaignGame(); //initialise a game where the player is coming from the campaign menu to play a mission SetPlayerFaction(); //pick the player faction ID. InitDefaultEntities(); //initialise the pre-spawned faction units and factions ResourceMgr.InitResources(); //init the pre-spawned resources. UnitMgr.OnFactionSlotsInitialized(); //init free units BuildingMgr.OnFactionSlotsInitialized(); //init free buildings if (MultiplayerGame) //if this is a multiplayer game { InputMgr.OnFactionSlotsInitialized(); //init spawnable prefabs and default entities in a multiplayer game } //In order to avoid having buildings that are being placed by AI players and units collide, we will ignore physics between their two layers: Physics.IgnoreLayerCollision(LayerMask.NameToLayer("Hidden"), LayerMask.NameToLayer("Unit")); //Set the amount of the active factions: activefactionsAmount = factions.Count; SetGameState(GameState.running); //the game state is now set to running UIMgr.PeaceTime.Toggle(peaceTime > 0.0f); //enable the peace time panel if there's actual peace time assigned //reaching this point means that all faction info/stats in the game manager are ready: Initialized = true; }