void Awake() { shooterControl = turret.GetComponent <ShooterControl>(); turretControl = turret.GetComponent <TurretControl>(); hoodControl = hood.GetComponent <HoodControl>(); flywheelControl = flywheel.GetComponent <FlywheelControl>(); intakeControl = intake.GetComponent <IntakeControl>(); }
void StartGamne() { ShooterControl game = GameObject.FindObjectOfType <ShooterControl>(); if (game != null) { game.SetState(ShooterControl.GameState.BEFORE_FIRE); } }
void OnTriggerEnter(Collider other) { ShooterControl player = GameObject.FindObjectOfType <ShooterControl>(); if (player != null) { player.SetState(ShooterControl.GameState.CLEAR); GetComponent <Animator>().SetTrigger("Clear"); } }
private void Start() { rb = GetComponent <Rigidbody>(); robotSoundControl = GetComponent <RobotSoundControl>(); audioManager = GameObject.Find("ScoreKeeper").GetComponent <AudioManager>(); previousRealTime = Time.realtimeSinceStartup; Console.WriteLine("Started....."); receiveThread = new Thread(receiveFromRC); receiveThread.Start(); sendThread = new Thread(sendToRC); sendThread.Start(); shooterControl = shooter.GetComponent <ShooterControl>(); shooterControl.Commands.Add(() => motorPower6 > 0, shooterControl.shooting); shooterControl.Commands.Add(() => motorPower7 >= 0, () => { robotSoundControl.playShooterRev(motorPower7); shooterControl.setVelocity(motorPower7); }); intakeControl = intake.GetComponent <IntakeControl>(); intakeControl.Commands.Add(() => motorPower5 != 0, () => { robotSoundControl.playIntakeRev(motorPower5); intakeControl.setVelocity(motorPower5 * 150); intakeControl.deployIntake(); }); intakeControl.Commands.Add(() => motorPower5 == 0, () => { robotSoundControl.playIntakeRev(motorPower5); intakeControl.retractIntake(); }); grabberControl = grabber.GetComponent <GrabberControl>(); grabberControl.Commands.Add(() => motorPower8 > 0, () => { grabberControl.startGrab(); }); grabberControl.Commands.Add(() => motorPower8 > 0.5, () => { grabberControl.lift(); }); grabberControl.Commands.Add(() => motorPower8 == 0, () => { grabberControl.stopGrab(); }); }
protected int m_nIdx = 0; //< This cannon index in the cannon list /* ----------------------------------------------------------------------------------------------------------- * UNITY'S STUFF HERE * ----------------------------------------------------------------------------------------------------------- */ /// <summary> /// Will execute when loaded /// </summary> void Awake() { Script = this; // Get the main script mainScript = GameObject.Find("/GameCode").GetComponent<ShooterControl>(); if(!mainScript) { // DEBUG Debug.LogError(this.transform + " could get the ShooterControl from Code"); } RegisterMyselfWithMainScript(); }
/* ----------------------------------------------------------------------------------------------------------- * UNITY'S STUFF HERE * ----------------------------------------------------------------------------------------------------------- */ /// <summary> /// Will execute when loaded /// </summary> void Awake() { Script = this; }
private void Start() { rb = GetComponent <Rigidbody2D>(); instance = this; }
void Start() { rb = GetComponent <Rigidbody>(); shooter = GameObject.FindObjectOfType <ShooterControl>(); layerNum = LayerMask.NameToLayer("Wall"); }