Ejemplo n.º 1
0
    void Start()
    {
        speed        = Vector3.zero;
        controller   = GetComponent <CharacterController> ();
        anim         = GetComponent <Animator> ();
        aiming       = GetComponent <AimAt> ();
        weaponSwitch = GetComponent <WeaponSwitch> ();


        for (int i = 1; i <= layerAmount; i++)
        {
            anim.SetLayerWeight(i, 0);
        }
        if (weaponSwitch.equippedWeapon != null)
        {
            aiming.looksAtTarget = true;
            anim.SetLayerWeight(weaponSwitch.equippedWeaponGunScr.holdingPose, 100);
        }
        else
        {
            aiming.looksAtTarget = false;
        }

        bulletStart = shootingPivot.transform.FindChild("BulletStart").gameObject;
        if (bulletStart == null)
        {
            Debug.Log("Error : BulletStart not found !");
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        player    = GameObject.Find("Player");
        anim      = GetComponent <Animator>();
        aimingScr = GetComponent <AimAt>();
        gunScr    = gun.GetComponent <Gun>();
        if (aimingScr.laserSight != null)
        {
            laser = aimingScr.laserSight.GetComponent <LineRenderer>();
        }
        unit = GetComponent <Unit>();

        if (player != null)
        {
            aimingScr.target = player;
        }
    }