Пример #1
0
 void Awake()
 {
     shooterControl  = turret.GetComponent <ShooterControl>();
     turretControl   = turret.GetComponent <TurretControl>();
     hoodControl     = hood.GetComponent <HoodControl>();
     flywheelControl = flywheel.GetComponent <FlywheelControl>();
     intakeControl   = intake.GetComponent <IntakeControl>();
 }
Пример #2
0
    void StartGamne()
    {
        ShooterControl game = GameObject.FindObjectOfType <ShooterControl>();

        if (game != null)
        {
            game.SetState(ShooterControl.GameState.BEFORE_FIRE);
        }
    }
Пример #3
0
    void OnTriggerEnter(Collider other)
    {
        ShooterControl player = GameObject.FindObjectOfType <ShooterControl>();

        if (player != null)
        {
            player.SetState(ShooterControl.GameState.CLEAR);
            GetComponent <Animator>().SetTrigger("Clear");
        }
    }
Пример #4
0
    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();
        });
    }
Пример #5
0
	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();
	}
Пример #6
0
 /* -----------------------------------------------------------------------------------------------------------
  * UNITY'S STUFF HERE
  * -----------------------------------------------------------------------------------------------------------
  */
 /// <summary>
 /// Will execute when loaded
 /// </summary>
 void Awake()
 {
     Script = this;
 }
Пример #7
0
 private void Start()
 {
     rb       = GetComponent <Rigidbody2D>();
     instance = this;
 }
Пример #8
0
 void Start()
 {
     rb       = GetComponent <Rigidbody>();
     shooter  = GameObject.FindObjectOfType <ShooterControl>();
     layerNum = LayerMask.NameToLayer("Wall");
 }