// 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 ();
	}
Esempio n. 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();
    }
    // Use this for initialization
    protected new void Initialize()
    {
        base.Initialize();
        _rend = GetComponent <SpriteRenderer>();
        _previousPositions = new Vector3[(int)(60 * UpdateDelaySeconds)];

        if (isParent)
        {
            Invoke("ToggleCanUpdatePast", UpdateDelaySeconds);
            var otherGO = (GameObject)Instantiate(gameObject, transform.position, transform.localRotation);
            Shadow          = otherGO.GetComponent <TimeAffected>();
            Shadow.isParent = false;
            Shadow.Initialize();
            Shadow.ToggleReality();
        }
    }
	// Use this for initialization
	protected new void Initialize()
	{
		base.Initialize();
		_rend = GetComponent<SpriteRenderer>();
		_previousPositions = new Vector3[(int)(60*UpdateDelaySeconds)];

		if (isParent)
		{
			Invoke("ToggleCanUpdatePast", UpdateDelaySeconds);
			var otherGO = (GameObject) Instantiate(gameObject, transform.position, transform.localRotation);
			Shadow = otherGO.GetComponent<TimeAffected>();
			Shadow.isParent = false;
			Shadow.Initialize();
			Shadow.ToggleReality();
		}
	}
    void Start()
    {
        _player           = GameObject.Find("Player").GetComponent <PlayerController> ();
        _timeAffected     = GameObject.Find("Player").GetComponent <TimeAffected>();
        _playerTargetable = _player.GetComponent <Targetable> ();
        _playerMovement   = _player.GetComponent <PlayerMovement> ();
        _oilScreen        = (Texture)Resources.Load("OilScreen");
        _shadowBlinkIcon  = (Texture)Resources.Load("ShadowBlinkIcon");

        _layerJumpIcons[0] = (Texture)Resources.Load("LayerJumpIconToFront");
        _layerJumpIcons[1] = (Texture)Resources.Load("LayerJumpIconToMiddle");
        _layerJumpIcons[2] = (Texture)Resources.Load("LayerJumpIconToBack");

        _layerJumpIcon = _layerJumpIcons[1];

        _joyStickIcon    = (Texture)Resources.Load("JoyStick");
        _joyStickPadIcon = (Texture)Resources.Load("JoyStickPad");

        _joyStickPadRect = new Rect(_joyStickOrigin.x - _joyStickPadSize / 2, _joyStickOrigin.y - _joyStickPadSize / 2,
                                    _joyStickPadSize, _joyStickPadSize);
    }
	void Start ()
	{
		_player = GameObject.Find ("Player").GetComponent<PlayerController> ();
        _timeAffected = GameObject.Find("Player").GetComponent<TimeAffected>();
        _playerTargetable = _player.GetComponent<Targetable> ();
		_playerMovement = _player.GetComponent<PlayerMovement> ();
		_oilScreen = (Texture)Resources.Load ("OilScreen");
		_shadowBlinkIcon = (Texture)Resources.Load ("ShadowBlinkIcon");

        _layerJumpIcons[0] = (Texture)Resources.Load("LayerJumpIconToFront");
        _layerJumpIcons[1] = (Texture)Resources.Load("LayerJumpIconToMiddle");
        _layerJumpIcons[2] = (Texture)Resources.Load("LayerJumpIconToBack");

        _layerJumpIcon = _layerJumpIcons[1];

        _joyStickIcon = (Texture)Resources.Load ("JoyStick");
		_joyStickPadIcon = (Texture)Resources.Load ("JoyStickPad");

		_joyStickPadRect = new Rect (_joyStickOrigin.x - _joyStickPadSize / 2, _joyStickOrigin.y - _joyStickPadSize / 2,
			_joyStickPadSize, _joyStickPadSize);
	}