Esempio n. 1
0
    protected void Awake()
    {
		this.rbd = this.GetComponent<Rigidbody>();

#if (!UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2)
		this.rbd2D = this.GetComponent<Rigidbody2D>();
#endif	
        this.projectile = this.GetComponent<EventTrigger>();
        this.projectile.AddOnListenStartDelegate(this.OnLaunched);
        this.projectile.AddOnListenUpdateDelegate(this.OnLaunchedUpdate);
        this.projectile.AddOnFireDelegate(this.OnEventTriggerFire);
    }
	    void Awake()
	    {
			GameObject source;
			if (this.altSource)
				source = this.altSource;
			else
				source = this.gameObject;
			
			var ctrl = source.GetComponent<EventFireController>();
			if (ctrl != null)
			{
				this.fireCtrl = ctrl;
				this.fireCtrl.AddOnFireDelegate(this.OnFire);
			}
			else
			{
				var eventTrigger = source.GetComponent<EventTrigger>();
				if (eventTrigger != null)
				{
					this.eventTrigger = eventTrigger;
					this.eventTrigger.AddOnFireDelegate(this.OnFire);
				}
			}
			
			if (this.fireCtrl == null && this.eventTrigger == null)
				throw new MissingComponentException("Must have either an EventFireController or EventTrigger.");

		}