Exemplo n.º 1
0
    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>();
        }
    }
Exemplo n.º 2
0
    private void Start()
    {
        weaponManager = GetComponent <WeaponManager>();
        unit          = GetComponent <Unit>();

        driver = GetComponent <AnimationDriverBase>();

        sensor = GetComponentInChildren <Sensor>();
        if (sensor != null)
        {
            sensor.OnDetect += OnSensorDetect;
        }
    }