// Use this for initialization
	public void Start ()
	{
		PauseController = GameObject.Find("PauseCanvas").GetComponent<PauseController>();
		_timeAffected = GetComponent<TimeAffected> ();
		_timeAffected.ShadowBlinkHandler += OnShadowBlink;
		_timeAffected.PassPauseController (PauseController);
		_layeredController = GetComponent<LayeredController> ();
		_targetable = gameObject.GetComponent<Targetable> ();
		_targetable.DeathEventHandler += OnDeath;
		_camera = Camera.main.GetComponent<CameraController> ();
		_musicController = gameObject.GetComponent<MusicController> ();
		GetComponent<LayeredController> ().LayerChangedEventHandler += UpdateLayerTransparencyOnLayerChange;
		GetComponent<LayeredController> ().LayerChangedEventHandler += UpdateMusicOnLayerChange;

		_bigGearPrefab = (GameObject)Resources.Load ("BigGear");
		_smallGearPrefab = (GameObject)Resources.Load ("SmallGear");
		_bigGear = Instantiate (_bigGearPrefab).GetComponent<GearController> ();
		_bigGear.PassPauseController (PauseController);
		_smallGear = Instantiate (_smallGearPrefab).GetComponent<GearController> ();
		_smallGear.PassPauseController (PauseController);
		_bigGear.Player = this;
		_smallGear.Player = this;
		_bigGear.RotationSpeed = _bigGearDefaultRotationSpeed;
		_smallGear.RotationSpeed = _smallGearDefaultRotationSpeed;
		_bigGear.Damage = _bigGearDamage;
		_smallGear.Damage = _smallGearDamage;
        _layeredController.Initialize();

        UpdateLayerTransparencyOnLayerChange();
        SaveCheckpoint ();
	}
예제 #2
0
    // Use this for initialization
    public void Start()
    {
        PauseController = GameObject.Find("PauseCanvas").GetComponent <PauseController>();
        _timeAffected   = GetComponent <TimeAffected> ();
        _timeAffected.ShadowBlinkHandler += OnShadowBlink;
        _timeAffected.PassPauseController(PauseController);
        _layeredController             = GetComponent <LayeredController> ();
        _targetable                    = gameObject.GetComponent <Targetable> ();
        _targetable.DeathEventHandler += OnDeath;
        _camera          = Camera.main.GetComponent <CameraController> ();
        _musicController = gameObject.GetComponent <MusicController> ();
        GetComponent <LayeredController> ().LayerChangedEventHandler += UpdateLayerTransparencyOnLayerChange;
        GetComponent <LayeredController> ().LayerChangedEventHandler += UpdateMusicOnLayerChange;

        _bigGearPrefab   = (GameObject)Resources.Load("BigGear");
        _smallGearPrefab = (GameObject)Resources.Load("SmallGear");
        _bigGear         = Instantiate(_bigGearPrefab).GetComponent <GearController> ();
        _bigGear.PassPauseController(PauseController);
        _smallGear = Instantiate(_smallGearPrefab).GetComponent <GearController> ();
        _smallGear.PassPauseController(PauseController);
        _bigGear.Player          = this;
        _smallGear.Player        = this;
        _bigGear.RotationSpeed   = _bigGearDefaultRotationSpeed;
        _smallGear.RotationSpeed = _smallGearDefaultRotationSpeed;
        _bigGear.Damage          = _bigGearDamage;
        _smallGear.Damage        = _smallGearDamage;
        _layeredController.Initialize();

        UpdateLayerTransparencyOnLayerChange();
        SaveCheckpoint();
    }
 void Start()
 {
     _dispenserLayeredController = gameObject.GetComponent <LayeredController>();
     _dispenseLocation           = transform.Find("DispenseLocation").transform.position;
     Invoke("Dispense", DispenseDelay);
 }
	void Start ()
	{
        _dispenserLayeredController = gameObject.GetComponent<LayeredController>();
        _dispenseLocation = transform.Find("DispenseLocation").transform.position;
		Invoke("Dispense", DispenseDelay);
	}