public Reconnaissance() { Name = "Reconnaissance"; Description = "A special forces unit that scouts and spys on the enemy"; StandardIssueWeapon = new Blaster(); Soldiers = new List <ICharacter>(); }
void Start() { referenceObject = GameObject.FindWithTag("ObjectOne"); referenceScript = referenceObject.GetComponent <Blaster>(); myAnimator = myAnimatorObject.GetComponent <Animator>(); }
void Start() { Player = GameObject.FindGameObjectWithTag("Player"); camMoveScript = Camera.main.GetComponent <CamMove>(); blasterScript = Player.GetComponent <Blaster>(); inGameMenu.enabled = false; }
public static Blaster Instance() { if (instance == null) { instance = (new GameObject("Blaster")).AddComponent <Blaster>(); } return(instance); }
void Start() { referenceObject = GameObject.FindWithTag("ObjectOne"); referenceScript = referenceObject.GetComponent <Blaster>(); startPosition = transform.position; myAnimator = GetComponent <Animator>(); source.PlayOneShot(nonTargetSpawnClip); }
////////////// /// private void Test() { if (Blaster.Connected == false) { return; } if (buttonTest.Enabled == false) { return; } if (_selectedItem == null || _selectedItem.Tag == null) { return; } if (_selectedItem.Tag.GetType() != typeof(BlasterCommand)) { return; } BlasterCommand command = _selectedItem.Tag as BlasterCommand; if (command.RawData == null) { return; } switch (command.Speed) { case Speed.Fast: Blaster.Speed = 0; break; case Speed.Medium: Blaster.Speed = 1; break; case Speed.Slow: Blaster.Speed = 2; break; } switch (command.Port) { case Port.Both: Blaster.Send(0, command.RawData); break; case Port.One: Blaster.Send(1, command.RawData); break; case Port.Two: Blaster.Send(2, command.RawData); break; } }
//public LineRenderer subLineRenderer; //public GameObject tempLineRendererTarget; protected override void Start() { base.Start(); blaster = GetComponent <Blaster>(); StopDrawingGrappleLighting(); doGrabAction.AddOnUpdateListener(DoGrab, parentHand.handType); relativePushPullAction.AddOnUpdateListener(SetRelativePushPullMode, parentHand.handType); }
public void Launch(Blaster blaster) { transform.position = blaster.m_Barrel.position; transform.rotation = blaster.m_Barrel.rotation; gameObject.SetActive(true); m_Rigidbody.AddRelativeForce(Vector3.forward * blaster.m_Force, ForceMode.Impulse); StartCoroutine(TrackLifeTime()); }
private void Attack() { Blaster attack = Instantiate(Resources.Load("Projectiles/Blaster", typeof(Blaster)) as Blaster) as Blaster; attack.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 1f); attack.GetComponent <Rigidbody>().velocity = new Vector3(0f, 0f, 2f * attack.movementSpeed); attack.GetComponent <Blaster>().owner = transform; GetComponent <AudioSource>().Play(); attackCooldown = 15; }
private void Start() { deathScreen = GameObject.FindGameObjectWithTag("Tela_Morte"); // Define qual é o objeto da tela de morte Tempo_Derrota = GameObject.FindGameObjectWithTag("Tempo_Derrota").GetComponent <Text>(); aim = GameObject.FindGameObjectWithTag("Mira"); camMoveScript = Camera.main.GetComponent <CamMove>(); // Define quem é a Main Camera blasterScript = gameObject.GetComponent <Blaster>(); HealthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <Image>(); deathScreen.SetActive(false); TimeSinceStart = 0; }
// Use this for initialization private void Start() { telaVitoria = GameObject.FindGameObjectWithTag("Tela_Vitoria"); Tempo_Vitoria = GameObject.FindGameObjectWithTag("Tempo_Vitoria").GetComponent <Text>(); telaVitoria.SetActive(false); Mascara = GameObject.FindGameObjectWithTag("Boss").GetComponent <Mascara_Script>(); camMoveScript = Camera.main.GetComponent <CamMove>(); blasterScript = GameObject.FindGameObjectWithTag("Player").GetComponent <Blaster>(); core = GameObject.Find("Core"); TimeSinceStart = 0; }
// Start is called before the first frame update protected override void Start() { base.Start(); blaster = GetComponent <Blaster>(); lineRenderer = GetComponent <LineRenderer>(); audioSource = GetComponent <AudioSource>(); audioSource.clip = grappleAudioClip; //drawGrabAction.AddOnUpdateListener(DrawGrab, parentHand.handType); doGrabAction.AddOnUpdateListener(DoGrab, parentHand.handType); relativePushPullAction.AddOnUpdateListener(SetRelativePushPullMode, parentHand.handType); }
private static Vector3 GetDirection(Blaster blaster) { Vector3 dir = Vector3.one; switch (blaster.shotDirection) { case ShootDirections.Up: dir = blaster.transform.TransformDirection(Vector3.up); break; case ShootDirections.Down: dir = blaster.transform.TransformDirection(Vector3.down); break; } return(dir); }
public void ReturnObject(GameObject returnBlaster, Blaster type) { ISpawnedBlasters returnBlasters = returnBlaster.GetComponent <ISpawnedBlasters>(); if (type == Blaster.Players) { blastersPlayer.Push(returnBlasters); } if (type == Blaster.Enemies) { blastersEnemy.Push(returnBlasters); } returnBlaster.SetActive(false); }
public static GameObject CreateLaser(Blaster blaster) { GameObject laser = GetLaser(); Vector3 dir = GetDirection(blaster); var laserComponent = laser.GetComponent <Laser>(); laserComponent.Reset(blaster.GetLaserProperties(), blaster.GetShotInfo(), dir); laser.transform.position = blaster.transform.position; laser.transform.rotation = blaster.transform.rotation; laser.SetActive(true); return(laser); }
public void Launch(Blaster blaster) { // Position transform.position = blaster.barrel.position; // TODO SteamVR update barrel rotation to match properly transform.rotation = Camera.main.transform.rotation; // Activate gameObject.SetActive(true); // Fire body.AddForce(Camera.main.transform.forward * blaster.force, ForceMode.Impulse); // Track Lifetime StartCoroutine(TrackLifetime()); }
public void Launch(Blaster blaster) { //Position on blaster transform.position = blaster.m_Barrel.position; transform.rotation = blaster.m_Barrel.rotation; //Activate, enable gameObject.SetActive(true); //apply force, Fire, and track //Todo:setup force m_Rigidbody.AddRelativeForce(Vector3.forward * blaster.m_Force, ForceMode.Impulse); StartCoroutine(TrackLifetime()); }
private void buttonStart_Click(object sender, System.EventArgs e) { if (_selectedItem == null) { return; } _timeoutRemaining = _timeoutMax; _selectedItem.SubItems[0].Text = _timeoutRemaining.ToString() + " seconds remaining..."; buttonStart.Text = "&Stop"; buttonTest.Enabled = false; timerLearn.Enabled = true; listButtons.Focus(); Blaster.BeginLearn(new LearnCallback(OnLearnComplete)); }
private static IEnumerator StarFall(Gun gun, BulletScript script) { script.coroutines_running++; Vector3 pos; if (gun.client_user) { pos = new Vector3(Input.mousePosition.x / Screen.width, Input.mousePosition.y / Screen.height, 20); pos = PlayerFollow.camera.ViewportToWorldPoint(pos); pos = new Vector3(pos.x, 15, pos.z); } else { AIController AI = gun.GetComponentInParent <AIController>(); if (AI && AI.Target) { Transform ttr = AI.Target.transform; pos = new Vector3(ttr.position.x, ttr.position.y + 10f, ttr.position.z); } else { pos = Vector3.zero; } } float original_next_time = gun.next_time; GameObject new_bullet = Instantiate(gun.Bullet, pos, gun.Bullet.transform.rotation) as GameObject; NetworkServer.Spawn(new_bullet); Blaster blaster = gun as Blaster; gun.mez_threshold += 100; blaster.ReadyWeaponForFire(ref new_bullet); blaster.next_time = original_next_time; BulletScript new_script = new_bullet.GetComponent <BulletScript>(); new_script.can_pierce = true; new_script.rb.velocity = Vector3.zero; new_script.rb.useGravity = true; new_script.rb.constraints = RigidbodyConstraints.None; gun.mez_threshold -= 100; script.coroutines_running--; yield return(null); }
private void OnTriggerEnter(Collider other) { if (!pView.IsMine) { return; } if (other.tag.Equals("item") && !dead && !gc.getQuestionMode()) { if (!other.GetComponent <Blaster>().getIsOwned()) { if (other.GetComponent <Blaster>().getBlasterType() == 4) { goldObj = other.GetComponent <Blaster>(); gc.upperLevelQuestion(); } else { if (pbc.getEmptySlots() != 0) { pbc.addBlaster(other.GetComponent <Blaster>()); } else { Physics.IgnoreCollision(GetComponent <Collider>(), other); } } } } if (other.tag.Equals("outOfBounds")) { outOfBounds = true; outOfBoundsTimer = Time.time + outOfBoundsTimerLength; outOfBoundsImage.gameObject.SetActive(true); } if (other.tag.Equals("itemSpawn")) { Physics.IgnoreCollision(GetComponent <Collider>(), other); } }
private void Attack() { if (!targetFound) { return; } //target = Movement.Instance().transform.position; Blaster attack = Instantiate(Resources.Load("Projectiles/EnemyBlaster", typeof(Blaster)) as Blaster) as Blaster; attack.transform.position = gun.transform.position; attack.transform.eulerAngles = new Vector3(90f, transform.eulerAngles.y, 0f); attack.GetComponent <Rigidbody>().velocity = 16f * transform.forward; attack.GetComponent <Blaster>().owner = transform; if (gameObject != null) { GetComponent <AudioSource>().Play(); } cooldown = 45; }
void Start() { AIController AI = GetComponentInChildren <AIController>(); ModDisplay display = GetComponentInParent <ModDisplay>(); display.Mods.Add("<color=red>Boss: Adhutlio</color>"); AI.StartCoroutine(AI.SetState(AIController.Type.Conquer, Vector3.zero)); //AI.StartCoroutine(AI.PaintShell(Color.black)); Flurry flurry = GetComponentInChildren <Flurry>(); Blaster blaster = GetComponentInChildren <Blaster>(); string Layer = LayerMask.LayerToName(gameObject.layer); flurry.SetBaseStats(Layer); blaster.SetBaseStats(Layer); flurry.level = 3; blaster.level = 3; flurry.AddAbility(blaster.GetGunModAbility(5)); flurry.AddAbility(4); flurry.AddAbility(7); blaster.AddAbility(5); blaster.AddAbility(9); blaster.AddAbility(flurry.GetGunModAbility(6)); }
private void Awake() { this._blaster = this.gameObject.GetComponentInParent <Blaster>(); this._deflectionXs = new float[] { -67.5f, -45f, -20f, 20f, 45f, 67.5f }; this._deflectionYs = new float[] { 90f, 135f, 150f, 180f, 210f, 225f, 270f }; this.transform.rotation = this.gameObject.transform.parent.rotation; this.gameObject.transform.parent = null; Vector3 targetPos = this._blaster.GetWielder().Target.GetComponent <IShootable>().GetShootAt().position; Vector3 lookAtPos = new Vector3(targetPos.x, targetPos.y, targetPos.z); this.transform.LookAt(lookAtPos, Vector3.up); }
private async void initializeScene(string sceneName) //test stuff inside! will need to be rewritten for actual game { running = true; saveDataThread = new Thread(saveData); saveDataThread.Start(); if (currentSettings == "") { currentSettings = SettingsManager.DEFAULT_SETTINGS; } SettingPairs settingPairs = settingsManager.getSettingPairs(currentSettings); settingList = settingsManager.getSettingList(currentSettings); fieldSize = Field.getFieldSize(settingPairs.field_size); foreach (PartData partData in partsData) { Part part = partManager.partDataToPart(partData); if (part.GAME_OBJECT != null) { part.toggleGameObject(false); } parts.Add(part); } if (currentTest == TESTS.BUILD_HUB) { IconGenerator iconGenerator = new IconGenerator(); Camera camera = null; foreach (Camera currCam in Camera.allCameras) { if (currCam.name == "IconCamera") { camera = currCam; camera.forceIntoRenderTexture = true; break; } } iconGenerator.camera = camera; Camera.main.targetDisplay = 1; foreach (Part part in parts) { if (part.GAME_OBJECT == null) { continue; } part.toggleGameObject(true); part.GAME_OBJECT.transform.Rotate(new Vector3(9, 120, -15)); iconGenerator.gameObjectOfIcon = part.GAME_OBJECT; while (part.getIcon() == null) { if (part.GAME_OBJECT.GetComponent <Renderer>().isVisible) { iconGenerator.initialize(); if (iconGenerator.getIcon() != null) { part.setIcon(iconGenerator.getIcon()); } } if (part.getIcon() == null) { await Task.Delay(25); } } part.toggleGameObject(false); part.destroyGameObject(); } Camera.main.targetDisplay = 0; } else { foreach (Part part in parts) { if (part.GAME_OBJECT != null) { part.destroyGameObject(); } } } experience = playerData.experience; credits = playerData.credits; previousRoundDamageDifference = playerData.previousRoundDamageDifference; previousRoundMaxDamageDifference = playerData.previousRoundMaxDamageDifference; previousRoundTimeElapsed = playerData.previousRoundTimeElapsed; ObstacleGenerator obstacleGenerator = new ObstacleGenerator(experience, settingPairs.max_obstacles, fieldSize); humanRobotParts = new List <Part>(); obstaclesData = new List <ObstacleData>(); List <int> badIndices = new List <int>(); PerformanceMetricCalculator performanceMetricCalculator = new PerformanceMetricCalculator(); Head cheapestHead = null; Body cheapestBody = null; Mobility cheapestMobility = null; Blaster cheapestBlaster = null; foreach (Part part in parts) { if (part is Head && (cheapestHead == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestHead))) { cheapestHead = (Head)part; } else if (part is Body && (cheapestBody == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBody))) { cheapestBody = (Body)part; } else if (part is Mobility && (cheapestMobility == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestMobility))) { cheapestMobility = (Mobility)part; } else if (part is Blaster && (cheapestBlaster == null || performanceMetricCalculator.calculateCost(part) < performanceMetricCalculator.calculateCost(cheapestBlaster))) { cheapestBlaster = (Blaster)part; } } if (playerData.humanRobotParts != default) { for (int partIndex = 0; partIndex < playerData.humanRobotParts.Length; ++partIndex) { PlayerPartData playerPartData = playerData.humanRobotParts[partIndex]; if (parts.Exists(p => p.getID() == playerPartData.id)) { Part part = parts.Find(p => p.getID() == playerPartData.id); part.damage(part.getDurability() - playerPartData.remainingDurability); if (part is Head) { humanRobotParts.Add((Head)part.clone(true)); } else if (part is Body) { humanRobotParts.Add((Body)part.clone(true)); } else if (part is Mobility) { humanRobotParts.Add((Mobility)part.clone(true)); } else if (part is Attachment) { humanRobotParts.Add((Attachment)part.clone(true)); } } else { humanRobotParts.Add(null); badIndices.Add(partIndex); } } } else { humanRobotParts.AddRange(new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }); } myRobots = new List <Robot>(); if (playerData.myRobots != default) { foreach (RobotData robotData in playerData.myRobots) { List <Part> robotPartList = new List <Part>(); foreach (int partIndex in robotData.partIndices) { if (!badIndices.Contains(partIndex)) { robotPartList.Add(humanRobotParts[partIndex]); } } try { Robot robot = new Robot(robotData.name, true, robotData.human, robotPartList.ToArray()); myRobots.Add(robot); } catch {} } } foreach (int index in badIndices) { humanRobotParts.RemoveAt(index); } if (!humanRobotParts.Exists(part => part is Head)) { humanRobotParts.Add(cheapestHead); } if (!humanRobotParts.Exists(part => part is Body)) { humanRobotParts.Add(cheapestBody); } if (!humanRobotParts.Exists(part => part is Mobility)) { humanRobotParts.Add(cheapestMobility); } if (!humanRobotParts.Exists(part => part is Attachment && ((Attachment)part).isWeapon())) { humanRobotParts.Add(cheapestBlaster); } if (humanRobotParts.Contains(null)) { throw new Exception("There are missing part files. There neeeds to be at least one part file each of types Head, Body, Mobility, and a weapon Attachment."); } if (playerData.obstacles != default) { obstaclesData.AddRange(playerData.obstacles); } else { obstaclesData.AddRange(obstacleGenerator.getObstaclesData()); } if (currentSettingValueList.Count == 0) { foreach (Setting setting in settingList) { currentSettingValueList.Add(setting.currentValue); } } Head head1 = null; Head head2 = null; Body body1 = null; Body body2 = null; Mobility mobility = null; Attachment attachment1 = null; Attachment attachment2 = null; Attachment attachment3 = null; foreach (Part part in parts) { if (part is Head) { if (head1 == null) { head1 = (Head)part.clone(true); head1.damage(2); } else if (head2 == null) { head2 = (Head)part.clone(true); head2.damage(3); } } else if (part is Body) { if (body1 == null) { body1 = (Body)part.clone(true); body1.damage(3); } else if (body2 == null) { body2 = (Body)part.clone(true); body2.damage(4); } } else if (part is Mobility) { if (mobility == null) { mobility = (Mobility)part.clone(true); mobility.damage(1); } } else if (part is Attachment) { if (attachment1 == null) { attachment1 = (Attachment)part.clone(true); attachment1.damage(1); } else if (attachment2 == null) { attachment2 = (Attachment)part.clone(true); attachment2.damage(1); } else if (attachment3 == null) { attachment3 = (Attachment)part.clone(true); attachment3.damage(3); } } } List <Robot> robots = new List <Robot>(); int numberOfNonHumanRobots = 0; int numberOfHumanRobots = 0; Obstacle[] obstacles = null; List <BuildHubState> buildHubStates = default; if (buildHubStatesData != default && buildHubStatesData.Count > 0) { buildHubStates = new List <BuildHubState>(); foreach (BuildHubStateData buildHubStateData in buildHubStatesData) { buildHubStates.Add(buildHubStateDataManager.stateDataToState(buildHubStateData)); } } List <FieldState> fieldStates = default; if (fieldStatesData != default && fieldStatesData.Count > 0) { fieldStates = new List <FieldState>(); foreach (FieldStateData fieldStateData in fieldStatesData) { fieldStates.Add(fieldStateDataManager.stateDataToState(fieldStateData, parts)); } } BuildHub.MODES mode; switch (currentTest) { case TESTS.FIELD: case TESTS.HUMAN_V_VOID_ROBOT: List <Part> humanParts = new List <Part>(); foreach (Part part in humanRobot.getParts()) { Part clonePart = part.clone(false); if (clonePart is Head) { clonePart = (Head)clonePart; } else if (clonePart is Body) { clonePart = (Body)clonePart; } else if (clonePart is Mobility) { clonePart = (Mobility)clonePart; } else if (clonePart is Attachment) { clonePart = (Attachment)clonePart; } humanParts.Add(clonePart); } humanRobot = new Robot(humanRobot.getName(), humanRobot.isHuman(), humanParts.ToArray()); currentHumanRobotHealth = humanRobot.getRemainingDurability(); Attachment[] nonHumanAttachments = { (Attachment)attachment1.clone(true) }; numberOfNonHumanRobots = RANDOM.Next(1, settingPairs.max_ai_robots + 1); numberOfHumanRobots = 1; obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray()); aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, new Robot[] { humanRobot }, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience); robots.Add(humanRobot); robots.AddRange(aiManager.getAgentRobots()); setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed)); break; case TESTS.AI_AGENT_TRAINING: numberOfNonHumanRobots = NUMBER_OF_AGENTS; numberOfHumanRobots = 0; obstacles = obstacleGenerator.obstaclesDataToObstacles(obstaclesData.ToArray()); aiManager = new AIManager(numberOfNonHumanRobots, numberOfNonHumanRobots - 1 + numberOfHumanRobots, null, parts.ToArray(), new Part[] { cheapestHead, cheapestBody, cheapestMobility, cheapestBlaster }, obstacles, fieldSize, buildHubStates, fieldStates, experience); Robot[] agentRobots = aiManager.getAgentRobots(); for (int agentIndex = 0; agentIndex < NUMBER_OF_AGENTS; ++agentIndex) { FIELD_AGENT_ROBOTS[agentIndex] = agentRobots[agentIndex]; } robots.AddRange(FIELD_AGENT_ROBOTS); setScreen(new Field(settingList, robots.ToArray(), obstacles, previousRoundDamageDifference, previousRoundMaxDamageDifference, previousRoundTimeElapsed)); break; case TESTS.BUILD_HUB: mode = BuildHub.MODES.MY_ROBOTS; setScreen(new BuildHub(settingList, obstaclesData, myRobots, humanRobotParts, parts.ToArray(), credits, mode)); break; } }
public void Spawn(Blaster blaster) { gameObject.SetActive(true); transformCache.position = blaster.TransformCache.position; type = blaster.Type; }
public void AddBlaster(Blaster blast) { if(!blasters.Contains(blast)) blasters.Add (blast); }
public void RemoveBlaster(Blaster blast) { if(blasters.Contains(blast)) blasters.Remove (blast); }
protected virtual void Start() { parentBlaster = GetComponent <Blaster>(); isBlockingGrapple = false; }
public TrooperArena(Blaster armamento) : base(armamento) { }
// Use this for initialization void Start() { // Setting up references. anim = GetComponent<Animator> (); trans = GetComponent<Transform> (); blaster = transform.root.GetComponent<Blaster>(); // initiate Player Relocate (panel_num); }
public StormTrooper() { Weapon = new Blaster(); }
public void ReloadPlayerTest() { Blaster b = new Blaster(); b.ReloadPlayer("test"); }
public void ReloadWallTest() { Blaster b = new Blaster(); b.ReloadWall("test"); }