Ejemplo n.º 1
0
    void EquipWeapon(Weapon weapon)
    {
        // Set currentWeapon to new weapon, weaponModel to the new weapon's model
        this.currentWeapon = weapon;
        Destroy(this.weaponModel); // Note: it may be inefficient to destroy the model entirely (it can be re-used!)
        this.weaponModel = Instantiate(this.currentWeapon.weaponModel) as GameObject;
        this.weaponModel.transform.SetParent(this.weaponBase, false);

        // Set the newly instantiated weaponModel to the correct layer
        if (this.isLocalPlayer)
        {
            Util.SetLayersRecursively(this.weaponModel, LayerMask.NameToLayer(this.viewmodelLayerName));
        }
        else
        {
            Util.SetLayersRecursively(this.weaponModel, LayerMask.NameToLayer(this.remotePlayerLayerName));
        }

        // Set weaponEffects to the new weapon's WeaponEffects
        this.weaponEffects = this.weaponModel.GetComponent <WeaponEffects>();
        if (this.weaponEffects == null)
        {
            Debug.LogError(GetType() + ": weapon model does not have a WeaponEffects script attached");
        }
    }
Ejemplo n.º 2
0
 void Start()
 {
     WeaponEffectsComponent = Camera.main.GetComponent <CameraControl>().playerObj.GetComponent <FPSPlayer>().WeaponEffectsComponent;
     myTransform            = transform;
     initialHitPoints       = hitPoints;
     aSource = GetComponent <AudioSource>();
 }
Ejemplo n.º 3
0
 public void RegisterWeaponEffect(WeaponEffect weaponEffect)
 {
     if (weaponEffect != null && !WeaponEffects.Contains(weaponEffect) && !WeaponEffectsToAdd.Contains(weaponEffect))
     {
         WeaponEffectsToAdd.Add(weaponEffect);
     }
 }
Ejemplo n.º 4
0
        static void LoadData()
        {
            weaponEffects = new List <ItemEffect>();
            List <ItemEffectDto> weaponEffectDtos = GoogleSheets.Get <ItemEffectDto>(Folders.InCoreData("DnD - WeaponEffects.csv"), false);

            foreach (ItemEffectDto itemEffect in weaponEffectDtos)
            {
                WeaponEffects.Add(ItemEffect.From(itemEffect));
            }
        }
Ejemplo n.º 5
0
    //private WorldRecenter WorldRecenterComponent;

    void Start()
    {
        WeaponEffectsComponent = Camera.main.GetComponent <CameraControl>().playerObj.GetComponent <FPSPlayer>().WeaponEffectsComponent;
        myTransform            = transform;
        //WorldRecenterComponent = Camera.main.GetComponent<CameraControl>().playerObj.transform.GetComponent<WorldRecenter>();
        if (!isRadiusCollider)
        {
            //get radius value from sphere collider radius of child radius object
            radius = myTransform.GetComponentInChildren <SphereCollider>().radius;
            AlignToGround();            //automatically align radius collider object's angles and position with the ground underneath it
        }
    }
Ejemplo n.º 6
0
    public static WeaponEffect GetWeaponEffect(WeaponEffects type)
    {
        switch (type)
        {
        case WeaponEffects.WeaponChill:
            return(new ApplyChilled());

        case WeaponEffects.WeaponStun:
            return(new ApplyStunned());

        case WeaponEffects.WeaponEndTurn:
            return(new OwnerEndTurn());
        }
        return(null);
    }
Ejemplo n.º 7
0
    void OnEnable()
    {
        myTransform = transform;
        if (muzzleFlash)
        {
            muzzleFlashTransform = muzzleFlash.transform;
        }
        AIComponent            = myTransform.GetComponent <AI>();
        WeaponEffectsComponent = AIComponent.playerObj.GetComponent <FPSPlayer>().weaponObj.GetComponent <WeaponEffects>();
        playerObj = Camera.main.transform.GetComponent <CameraControl>().playerObj;
        FPSWalker = playerObj.GetComponent <FPSRigidBodyWalker>();
        aSource   = GetComponent <AudioSource>();

        //bulletsLeft = bulletsPerClip;
        shootStartTime = -fireRate * 2;
    }
Ejemplo n.º 8
0
    void EquipWeapon(PlayerWeapon weapon)
    {
        currentWeapon = weapon;
        GameObject weaponInstance = Instantiate(weapon.graphics, weaponHolder.position, weaponHolder.rotation, weaponHolder);

        currentEffects = weaponInstance.GetComponent <WeaponEffects>();
        if (currentEffects == null)
        {
            Debug.Log("No WeaponEffects component on the weapon object: " + weaponInstance.name);
        }

        if (isLocalPlayer)
        {
            Util.SetPlayerRecursively(weaponInstance, LayerMask.NameToLayer(weaponLayerName));
        }
    }
    public float dropLayerZ = 2f; // the layer that the drops are on (so they're in front)

    void Awake()
    {
        leftBoundary   = -14;
        rightBoundary  = 14;
        bottomBoundary = floor.transform.position.y;
        topBoundary    = 18f;

        audioManager   = GetComponentInChildren <AudioManager>();
        weaponEffects  = GetComponentInChildren <WeaponEffects>();
        shop           = (Shop)FindObjectOfType <Shop>();
        combatManager  = (CombatManager)FindObjectOfType <CombatManager>();
        dataStore      = this.GetComponent <DataStore>();
        playerInput    = this.GetComponent <PlayerInput>();
        scalingManager = this.GetComponent <ScalingManager>();

        Time.timeScale = 1;
    }
Ejemplo n.º 10
0
        public override void Update(GameTime gameTime)
        {
            foreach (WeaponEffect effect in WeaponEffects)
            {
                effect.Update(gameTime);
            }

            foreach (WeaponEffect effect in WeaponEffectsToRemove)
            {
                WeaponEffects.Remove(effect);
            }
            WeaponEffectsToRemove.Clear();

            foreach (WeaponEffect effect in WeaponEffectsToAdd)
            {
                WeaponEffects.Add(effect);
            }
            WeaponEffectsToAdd.Clear();
        }
Ejemplo n.º 11
0
    void Awake()
    {
        // Get all required components and objects
        player = GameObject.Find("Player").GetComponent<Player>();
        PlayerCollider = GameObject.Find("Player").GetComponent<BoxCollider2D>();
        FirePoint = transform.GetChild(0);
        weaponEffects = GetComponent<WeaponEffects> ();
        RandomizeFirerate = EnemyAimDelay;
        Arm = this.transform.parent.GetComponent<ArmRotation> ();

        audioSource = GameObject.Find ("AudioManager/EffectsAudio").GetComponent<AudioSource> ();

        if(FirePoint == null){
            Debug.LogError ("No 'FirePoint' object found.");
        }
        if(weaponEffects == null) {
            Debug.LogError ("Script for weapon effects is missing!");
        }
        if(WeaponFireSoundEffect == null){
            Debug.LogError ("WeaponFireSoundEffect is missing!");
        }
    }
Ejemplo n.º 12
0
 public WeaponEffectStruct(WeaponEffects effect, string[] values)
 {
     this.effect = effect;
     this.values = values;
 }
Ejemplo n.º 13
0
 private void Awake()
 {
     shotDelayHold      = _shotDelay;
     _weaponEffects     = GetComponentInChildren <WeaponEffects>();
     _weaponAttachments = GetComponentInParent <WeaponAttachments>();
 }
Ejemplo n.º 14
0
    // MonoBehaviour

    void Awake()
    {
        _effects = GetComponent <WeaponEffects>();
    }