public void Init(BaseWeaponSystem weaponSystem, AimUI aimUI)
 {
     this.weaponSystem    = weaponSystem;
     this.entityTransform = weaponSystem.gameObject.transform;
     this.aimUI           = aimUI;
     this.cam             = GameManager.Instance.sceneController.sceneCamera;
 }
    public void EquipGun(eGunType type)
    {
        Gun gunToEquip = WeaponManager.Instance.GetGunPrefab(type).GetComponent <Gun>();



        if (equippedGun != null)
        {
            Destroy(equippedGun.gameObject);
        }

        //weaponHold transform have Gun's position and rotation.(not local)
        Transform gunPosRot = weaponHold.GetChild((int)type);

        equippedGun = Instantiate(gunToEquip, gunPosRot.position, gunPosRot.rotation) as Gun;
        equippedGun.transform.parent = this.transform;

        IK.rightHandObj = equippedGun.RightGrabPosition;
        if (type == eGunType.Rifle || type == eGunType.Shotgun)
        {
            IK.leftHandObj = equippedGun.LeftGrabPosition;
        }

        IK.gunType = type;
        actor.gun  = equippedGun.GetComponent <Gun>();



        aimUI = UIManager.Instance.Aim.GetComponent <AimUI>();
        if (aimUI == null)
        {
            Debug.LogError("AimUI NULL");
        }
        else
        {
            Debug.Log("Aim!");
        }
    }
Exemple #3
0
    public void AimPrefabLoad()
    {
        GameObject go = Resources.Load("Prefabs/UI/Aim") as GameObject;

        if (go == null)
        {
            Debug.LogError("AIM loading fail");
        }
        else
        {
            Debug.Log("AIM loading success");
        }

        Aim = Instantiate(go);
        Aim.SetActive(false);

        Aim.transform.SetParent(canvas.transform);

        AimUI aimUI = Aim.GetComponent <AimUI>();

        aimUI.player = player;
        Debug.Log(player);
    }