// 터렛 정보 얻기 public void Bullet_State() { TurretControl state = transform.parent.GetComponent <TurretControl>(); damage = state.damage; Tag(); }
// Start is called before the first frame update void Start() { if (!turretScript) { turretScript = GameObject.Find("Turret").GetComponent <TurretControl>(); } if (!dataScript) { dataScript = GameObject.Find("SerialData").GetComponent <Data>(); } if (dataScript.serialPort == null || dataScript.serialPort == "") { port = "COM3"; } else { port = dataScript.serialPort; } stream = new SerialPort(port, 9600); stream.ReadTimeout = 50; stream.Open(); // Hardcoded String expected from Arduino sketch stream.Write("A"); timer = 0; seconds = 5; }
private void outlineTurret(TurretControl newTurretControl) { for (var i = 0; i < turretOutlines.Count; i++) { turretOutlines[i].outlineSize = i == (int)newTurretControl ? OutlineWidth : 0; } }
/// <summary> /// Spawns a turret for each specified target location /// </summary> /// <param name="targetLocations">Array of gameobject used as a target reference for where the turret goes to</param> public void SpawnTurrets(GameObject[] targetLocations) { if (targetLocations != null) { //Essentially resets arrays and sets new lengths _spawnedTurrets = new TurretControl[targetLocations.Length]; //Spawns a turret and chain for each given location for (int x = 0; x < targetLocations.Length; x++) { TurretControl control = Instantiate(turretPrefab, transform.position, transform.rotation).GetComponent <TurretControl>(); _spawnedTurrets[x] = control; control.targetLocationObj = targetLocations[x]; control.isMoving = true; //Spawns a random attack onto the turret Instantiate(turretAttacks[Random.Range(0, turretAttacks.Length)], control.transform); ChainHandler chain = Instantiate(_chainPrefab, transform.position, transform.rotation).GetComponent <ChainHandler>(); chain.targetObj = control.gameObject; chain.bossObj = gameObject; _spawnedChains.Add(chain); } } StartCoroutine(SetupTurret()); }
void Start() { controlObject = GameObject.Find("Turret"); if (controlObject != null) { control = controlObject.GetComponent<TurretControl>(); } }
void Awake() { shooterControl = turret.GetComponent <ShooterControl>(); turretControl = turret.GetComponent <TurretControl>(); hoodControl = hood.GetComponent <HoodControl>(); flywheelControl = flywheel.GetComponent <FlywheelControl>(); intakeControl = intake.GetComponent <IntakeControl>(); }
void Awake() { turretControl = turret.GetComponent <TurretControl>(); hoodControl = hood.GetComponent <HoodControl>(); flywheelControl = flywheel.GetComponent <FlywheelControl>(); intakeControl = intake.GetComponent <IntakeControl>(); timer = Time.time; }
public void StartPlacing(GameObject towertemp) { if (placing == false) { placing = true; tower = towertemp; turretControl = tower.GetComponent <TurretControl> (); SetSpriteScale(); } }
// Use this for initialization void Start() { towerButtomImages = new Texture[towerObjects.Length]; towerCost = new int[towerObjects.Length]; for (int i = 0; i < towerObjects.Length; i++) { TurretControl turretControl = towerObjects [i].GetComponent <TurretControl> (); towerCost [i] = turretControl.cost; } }
void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == "Player") { Destroy(this.gameObject); ///DEAL DAMAGE TO PLAYER TurretControl target = coll.gameObject.GetComponent <TurretControl> (); TargetHit(target); /// } }
//태그 변경 //스킬일경우 체크 스킬이아니면 터렛ㅌㅐ그 //스킬이면 스킬태그로 파이어함 private void Tag() { if (this.gameObject.tag == "Skill") { gameObject.tag = string.Format(Skill7777.skillName); } else { TurretControl state = transform.parent.GetComponent <TurretControl>(); switch (state.turretLevel) { case 2: gameObject.tag = "Bullet1"; break; case 3: gameObject.tag = "Bullet2"; break; case 4: gameObject.tag = "Bullet3"; break; case 5: gameObject.tag = "Bullet4"; break; case 6: gameObject.tag = "Bullet5"; break; case 7: gameObject.tag = "Bullet6"; break; case 8: gameObject.tag = "Bullet7"; break; case 9: gameObject.tag = "Bullet8"; break; case 10: gameObject.tag = "Bullet9"; break; } } }
// Use this for initialization void Start() { if (!serialManager) { serialManager = GameObject.Find("GameManager").GetComponent <SerialManager>(); } //Determine initial position based on Transform position = transform.position; //Setup camera variables cam = Camera.main; height = 2f * cam.orthographicSize; width = height * cam.aspect; turretScript = gameObject.GetComponentInChildren <TurretControl>(); }
public Program() { // The constructor, called only once every session and // always before any other method is called. Use it to // initialize your script. // // The constructor is optional and can be removed if not // needed. // // It's recommended to set RuntimeInfo.UpdateFrequency // here, which will allow your script to run itself without a // timer block. turretControl = new TurretControl(this, Me); }
private void HandleHorizontalPressed(InputValue inputValue) { switch (inputValue.Get <float>()) { case -1: turretControl = TurretControl.Left; break; case 0: turretControl = TurretControl.Center; break; case 1: turretControl = TurretControl.Right; break; } outlineTurret(turretControl); }
} // End KillUnit() /** * Removes HP from the unit * @param hp - The amount of hp to take. * @param towerType - The type of tower dealing the damage. * */ public void TakeHit(int hp, string towerType, TurretControl turretControl) { // Flash the unit's button red on hit GameObject.Find(UnitButton.name + "/UnitBKG").GetComponent <UISprite> ().color = new Color(.9f, .1f, .1f); StartCoroutine(ChangeLabelColorBack()); // Push a notification to the console: Console.Push("Unit " + GameVars.UCFirst(Type) + " has been hit!"); Debug.Log(Type); // We will use this for special abilities. ;) switch (towerType) { case "Flamethrower": if (Type == "firefighter") { Debug.Log("HERE"); turretControl.RotationSpeed = 0; turretControl.HitPercentage = 0; turretControl.HPOnHit = 0; turretControl.Range = 0; turretControl.setTowerTint(new Color(.3f, .3f, .3f)); } break; default: break; } // End switch if (HP > 0) { StartCoroutine(TakeHP(hp)); } } // End TakeHit()
void Awake() { pGui = transform.parent.gameObject.GetComponent<PlayerGui> (); teamIdentity = transform.parent.gameObject.GetComponent<TeamIdentity> (); turretControl = GetComponent<TurretControl> (); }
void Start() { turretControl = GetComponent <TurretControl>(); }
void TargetHit(TurretControl player) { player.playerHealth -= enemyProjectileDamage; print("Player health - " + player.playerHealth); }
// store references to everything we need void Awake() { control = GetComponent<TurretControl> (); weapon = GetComponent<Weapon> (); parentIdentity = transform.parent.GetComponent<NetworkIdentity> (); }
void Awake() { turretData = turret.GetComponent <TurretControl>(); }
private void Start() { turretControl = GetComponentInChildren <TurretControl>(); }
// touch input public void fire() { TurretControl i = GameObject.FindGameObjectWithTag("Player").GetComponent <TurretControl> (); i.fire(); }
//Initializes the hardpoint with the needed stuff regardless of whatever else exists. public void Start() { turret = this.transform.parent.GetComponentInChildren<TurretControl>(); ship = this.transform.root.GetComponent<ShipManager>(); //activate(); }
public void findTurretControl() { turret = this.transform.parent.GetComponentInChildren<TurretControl>(); }
void Start() { render = GetComponent <MeshRenderer>(); control = GetComponentInParent <TurretControl>(); render.material.color = Color.black; }
public void clearTurretControl() { turret = null; }
public void StartUpgrading(GameObject turret) { upgrading = true; upgradingTurret = turret; turretControl = upgradingTurret.GetComponent <TurretControl> (); }