public override void DisposeNode() { gunControl = null; gun = null; pos = null; display = null; }
public override void SetUp() { gunControl = new GunControl(Keys.Space); gun = new Gun(0, 0); pos = new Position(); display = new Display(); }
// Use this for initialization private void Awake() { lastMove.y = -1; isSpotted = false; myRigidbody = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); myAudioSource = GetComponent <AudioSource>(); myRenderer = GetComponent <Renderer>(); equip = 0; gun = transform.Find("Gun").gameObject.GetComponent <GunControl>(); crosshair = transform.Find("Crosshair").gameObject; soundManager = GameObject.Find("Sound Manager").GetComponent <SoundManager>(); bowData = new BowData(); moveSpeed = defaultSpeed; health = maxHealth; searchableArea = transform.Find("Searchable Area").GetComponent <PlayerSearchableArea>(); flashlight = transform.Find("Flashlight").gameObject; }
private void Awake() { GameManager.Instance.OnPlayerSpawn += (player) => { control = player.GetComponent <GunControl>(); Assert.AreEqual(modeIconBackground.Length, control.GunCount); init = true; }; }
void OnGame() { if (GunControl.IsFireInput()) { if (gun.FireGun()) { fired = true; } } }
void Start() { _checkfire = true; _tenlua = false; Instance = this; _ani = GetComponent <Animator>(); _ani.Play("Idle", 0, 0); _ani.SetFloat("level", 0); _ani.speed = 2; _levelGun = 1; BonusCoin = 1; }
void Start() { scriptplayer = GameObject.FindWithTag("Player").GetComponent <PlayerControl>(); scriptGun = GameObject.FindObjectOfType(typeof(GunControl)) as GunControl; SliderHP.maxValue = scriptplayer.status.health; SliderHP.minValue = 0; Time.timeScale = 1; timeRecord = PlayerPrefs.GetFloat("TimeRecord"); textQtdBalas.text = string.Format("x {0}", scriptGun.currentAmmo); }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { GunControl scriptgun = other.GetComponent <GunControl>(); if (scriptgun.currentAmmo < scriptgun.totalAmmo) { scriptgun.Recarregar(ammo); Destroy(gameObject); ammoBoxScript.DiminuirQtdMunicoes(); } } }
void interact() { if (Input.GetKeyDown("f")) { RaycastHit target; if (Physics.Raycast(FPSCamera.transform.position, FPSCamera.transform.forward, out target, range)) { Debug.Log(target.transform.name); if (target.transform.tag == "Gun") { if (FPSCamera.transform.childCount > 0) { FPSCamera.transform.GetChild(0).GetComponent <GunControl>().unequip(); } GunControl gunControl = target.transform.GetComponent <GunControl>(); gunControl.Selected(FPSCamera.transform); } } } }
bool UpdateAttacker(Paratrooper attacker) { // This is a superhack. I know. float x = Mathf.Abs(attacker.transform.position.x); float y = attacker.transform.position.y; if (x < 1.6f) { // Attacker has hit the turret GunControl gun = GameObject.Find("Gun").GetComponent <GunControl>(); gun.ExplodeAndDie(); attacker.gameObject.GetComponent <Rigidbody2D>().gravityScale = 5; attacker.gameObject.GetComponent <Rigidbody2D>().drag = 0; attacker.gameObject.GetComponent <Rigidbody2D>().fixedAngle = false; attacker.gameObject.GetComponent <Rigidbody2D>().AddForce(new Vector3(-attacker.move.x * 30, 30), ForceMode2D.Impulse); attacker.gameObject.GetComponent <Rigidbody2D>().AddTorque(200 * attacker.move.x); attacker.move.x = 0; return(false); } else if (x >= 4.6f && y < 0.1f) { // Move towards turret on ground attacker.gameObject.GetComponent <Rigidbody2D>().gravityScale = 0; MoveAttacker(attacker, attacker.move.x, 0); } else if (x < 4.6f && y <= 6) { // Move up next to turret attacker.gameObject.GetComponent <Rigidbody2D>().gravityScale = 0; MoveAttacker(attacker, 0, 1); } else if (y > 6) { // Move towards turret on the turret MoveAttacker(attacker, attacker.move.x, 0); } return(true); }
// ****************************** private void BuildGame() { // Area _area = FindObjectOfType <Area>(); // Async _async = gameObject.AddComponent <Async>(); // Effects _effects = gameObject.AddComponent <Effects>(); // Area Controller _areaController = gameObject.AddComponent <AreaController>(); // UIController _uiController = gameObject.AddComponent <UIController>(); // Gun Control _gunControl = gameObject.AddComponent <GunControl>(); // Input _input = gameObject.AddComponent <InputStack>(); }
public override void SetComponent(Component comp) { if (comp.ClassId == pos.ClassId) { pos = (Position)comp; } else if (comp.ClassId == gun.ClassId) { gun = (Gun)comp; } else if (comp.ClassId == gunControl.ClassId) { gunControl = (GunControl)comp; } else if (comp.ClassId == display.ClassId) { display = (Display)comp; } else { throw new Exception("You passed a wrong component to the " + GetType().Name + " class"); } }
// Start is called before the first frame update void Start() { gunControl = transform.GetComponent <GunControl>(); gunControl.SetGunType(gunName, pistolHipLoc, pistolAimLoc, pistolDamage, pistolFireRate, pistolReloadTime, pistolAccuracy, isSelectiveFire, -1, pistolCapacity); }
// Update is called once per frame void Update() { if (state != State.Idle) { this.timer += Time.deltaTime; } switch (state) { case State.Idle: SetPositions(0); if (GunControl.IsFireInput()) { SetState(State.Ready); Play(Ready); NewGame(); } break; case State.Ready: SetPositions(timer); if (timer > 1) { SetState(State.Game); Play(Begin); } break; case State.Game: SetPositions(1); OnGame(); if (timer > 15) { SetState(State.Game3); Play(Three); } break; case State.Game3: SetPositions(1); OnGame(); if (timer > 1) { SetState(State.Game2); Play(Two); } break; case State.Game2: SetPositions(1); OnGame(); if (timer > 1) { SetState(State.Win); Play(One); } break; case State.Win: SetPositions(1 - timer); if (timer > 1) { SetState(State.Score); Play(Win); } break; case State.Score: SetPositions(0); if (timer > 1) { SetState(State.Idle); Play(Flawless); } break; } }
public void targetedByGun(GunControl gun) { targetedBy.Add(gun); }
void Awake() { _instance = this; }
void Activate() { birdGenerator = transform.root.GetComponent <BirdGenerator>(); gun = GameObject.FindWithTag("Gun").GetComponent <GunControl>(); activated = true; }
void Start() { _anim = gameObject.GetComponent<Animator>() as Animator; _gunControl = GetComponent<GunControl> (); //_AnimCamera = aimCamera.GetComponent<Animator>() as Animator; }
// Start is called before the first frame update void Start() { switchGunScript = gameObject.GetComponent <GunControl>(); }
// Start is called before the first frame update void Start() { gunControl = transform.GetComponent <GunControl>(); gunControl.SetGunType(gunName, AKHipLoc, AKAimLoc, AKDamage, AKFireRate, AKReloadTime, AKAccuracy, isSelectiveFire, 1, AKCapacity); }
private void Start() { rb = GetComponent <Rigidbody2D>(); col = GetComponent <Collider2D>(); gunCtrl = GetComponent <GunControl>(); }