private void Start() { driver = GetComponent <AnimationDriverBase>(); if (startAmmo != null) { if (startAmmo is IRangedWeaponAmmo) { currentAmmos = ScriptableObject.Instantiate(startAmmo) as IRangedWeaponAmmo; } else { Debug.LogWarning("StartAmmo defined on " + this.name + " is not a IRangedWeaponAmmo."); } } if (debugMainHandStartWeaponPrefab != null && MainHandWeapon == null && saveLoaded == false) { MainHandWeapon = (GameObject.Instantiate(debugMainHandStartWeaponPrefab, Vector3.zero, debugMainHandStartWeaponPrefab.transform.rotation) as GameObject).GetComponent <IWeapon>(); } if (debugOffHandStartWeaponPrefab != null && OffHandWeapon == null && saveLoaded == false) { OffHandWeapon = (GameObject.Instantiate(debugOffHandStartWeaponPrefab, Vector3.zero, debugOffHandStartWeaponPrefab.transform.rotation) as GameObject).GetComponent <IWeapon>(); } }
private void Start() { weaponManager = GetComponent <WeaponManager>(); unit = GetComponent <Unit>(); driver = GetComponent <AnimationDriverBase>(); sensor = GetComponentInChildren <Sensor>(); if (sensor != null) { sensor.OnDetect += OnSensorDetect; } }