void Awake() { if (instance != null) { Debug.LogError("More than one SpaceshipManager in scene !"); return; } instance = this; }
private void Start() { if (singleton == null) { singleton = this; } for (int i = 0; i < maxSpaceshipsSpawn; i++) { SpawnSpaceship(); } InvokeRepeating("SpawnSpaceship", 0, spawnSpaceshipDelay); }
private void Awake() { Instance = this; //_photonView = PhotonView.Get(this); //_currentSpaceshipIndex = 0; _mySpaceships = new List <GameObject>(); _myAttackSpaceships = new List <GameObject>(); _myDefenceSpaceships = new List <GameObject>(); _myMiningSpaceships = new List <GameObject>(); _selectSpaceshipManager = GetComponent <SelectSpaceshipManager>(); _pathfinder = GameObject.Find("Pathfinder2D").GetComponent <FlowPathfinding.Pathfinder>(); _audioSource = GetComponent <AudioSource>(); }
private void Awake() { Instance = this; _camera = Camera.main; _isCameraNotNull = _camera != null; _spaceshipManager = GetComponentInParent <SpaceshipManager>(); _spaceships = new List <Spaceship>(); _selectedSpaceships = new List <Spaceship>(); _selectedSeekers = new List <Seeker>(); _active = true; AutomationButton.SetActive(false); DeleteButton.SetActive(false); }
void Start() { score = 0; _gameOver = false; _topScoreListSize = 10; _playerName = ""; levelCount = 0; _levelSpeed = -5; _spaceshipManager = spaceshipGO.GetComponent <SpaceshipManager>(); currentLifes = _spaceshipManager.GetTotalLifes(); if (SceneManager.GetActiveScene().name == "Level") { StartCoroutine(SpawnWaves()); } }
protected virtual void Update() { if (OptionUI.isPaused) { return; } if (target == null) { SpaceshipManager.SetSpaceshipTarget(this); return; } distanceWithTarget = Vector3.Distance(transform.position, target.position); if (distanceWithTarget <= shotRange && Vector3.Angle(transform.forward, target.position - transform.position) < angleShot && !isReloading) { Shoot(); } FaceTarget(); Move(); }
private void Start() { spaceshipManager = SpaceshipManager.Instance; buySpaceships = GetComponent <BuySpaceships>(); }
// Use this for initialization void Start() { _fontSize = 30; _growthRate = 1; _spaceshipManager = spaceshipGO.GetComponent <SpaceshipManager>(); }
public void OnPhotonInstantiate(PhotonMessageInfo info) { Hashtable hashPlayer = info.Sender.CustomProperties; NetworkIdentity identity = GetComponent <NetworkIdentity>(); SpriteRenderer renderer = GetComponent <SpriteRenderer>(); renderer.enabled = false; SecurityRenderer.enabled = false; string color = (string)hashPlayer["Color"]; int currentId = (int)hashPlayer["CurrentId"]; identity._id = info.Sender.UserId + "_" + currentId; foreach (Sprite visual in CommandCenterVisuals) { if (visual.name == "CommandCenter_" + color) { gameObject.GetComponent <SpriteRenderer>().sprite = visual; break; } } foreach (Sprite visual in MiniMapIcons) { if (visual.name == "CommandCenter_" + color) { MiniMapIcon.sprite = visual; break; } } if (info.Sender.IsLocal) { identity._isLocal = true; renderer.enabled = true; MiniMapIcon.enabled = true; SecurityRenderer.enabled = true; Hashtable hash = new Hashtable(); hash["CurrentId"] = currentId + 1; info.Sender.SetCustomProperties(hash); GameObject mainCamera = GameObject.Find("Main Camera"); mainCamera.transform.position = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, -15); mainCamera.GetComponent <CameraControl>().SetPlayerBase(this.gameObject); SpaceshipManager manager = GameObject.Find("SpaceshipsManager").GetComponent <SpaceshipManager>(); manager.SetPlayerBase(this.gameObject); Vector3 basePosition = this.transform.position; Vector3 normal = Vector3.Normalize(Vector3.zero - basePosition); StoragePosition = basePosition + (10 * normal); } else { identity._isLocal = false; Transform[] childs = GetComponentsInChildren <Transform>(); foreach (Transform child in childs) { if (child.gameObject.CompareTag("CommandCenter")) { Destroy(child.GetComponent <SafeZone>()); continue; } if (child.gameObject.name == "MinimapIcon" || child.gameObject.name == "SecurityZone") { continue; } Destroy(child.gameObject); } } }