Esempio n. 1
0
 protected Weapon(string weaponType, WeaponHandling weaponHandling, int damage, int range)
 {
     this.weaponType = weaponType;
     this.weaponHandling = weaponHandling;
     this.damage = damage;
     this.range = range;
 }
Esempio n. 2
0
    public void fire(FireProps fireProps, BulletManager bm, WeaponHandling wh)
    {
        switch (playerInfo.charEnum)
        {
        case CharacterEnum.Tesla:
            specialInstance.SetActive(true);
            specialInstance.GetComponent <WeaponSpecialTeslaLogic>().fire();
            break;

        case CharacterEnum.Curie:
            specialInstance.SetActive(true);
            specialInstance.GetComponent <WeaponSpecialCurieLogic>().fire(fireProps);
            break;

        case CharacterEnum.DaVinci:

            specialInstance.GetComponent <WeaponSpecialDaVinciLogic>().fire(fireProps, wh);
            specialInstance.SetActive(true);
            //specialInstance.GetComponent<WeaponSpecialTeslaLogic>().fire();
            break;

        case CharacterEnum.Einstein:
            specialInstance.SetActive(true);
            specialInstance.GetComponent <WeaponSpecialEinsteinLogic>().fire(fireProps);
            break;

        case CharacterEnum.Nobel:
            specialInstance.SetActive(true);
            specialInstance.GetComponent <WeaponSpecialNobelLogic>().fire(fireProps);
            break;
        }
    }
Esempio n. 3
0
    public void fire(FireProps fireProps, BulletManager bm, WeaponHandling wh)
    {
        switch (playerInfo.charEnum)
        {
            case CharacterEnum.Tesla:
                specialInstance.SetActive(true);
                specialInstance.GetComponent<WeaponSpecialTeslaLogic>().fire();
                break;
            case CharacterEnum.Curie:
                specialInstance.SetActive(true);
                specialInstance.GetComponent<WeaponSpecialCurieLogic>().fire(fireProps);
                break;
            case CharacterEnum.DaVinci:

                specialInstance.GetComponent<WeaponSpecialDaVinciLogic>().fire(fireProps, wh);
                specialInstance.SetActive(true);
                //specialInstance.GetComponent<WeaponSpecialTeslaLogic>().fire();
                break;
            case CharacterEnum.Einstein:
                specialInstance.SetActive(true);
                specialInstance.GetComponent<WeaponSpecialEinsteinLogic>().fire(fireProps);
                break;
            case CharacterEnum.Nobel:
                specialInstance.SetActive(true);
                specialInstance.GetComponent<WeaponSpecialNobelLogic>().fire(fireProps);
                break;
        }
    }
Esempio n. 4
0
 public Dagger(
     string weaponType = "Dagger",
     WeaponHandling weaponHandling = WeaponHandling.OneHanded, 
     int damage = 45, 
     int range = 2)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 5
0
 public BastardSword(
     string weaponType = "Bastard Sword", 
     WeaponHandling weaponHandling = WeaponHandling.OneHanded, 
     int damage = 45, 
     int range = 2)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 6
0
 public GreatSword(
     string weaponType = "Great Sword",
     WeaponHandling weaponHandling = WeaponHandling.TwoHanded,
     int damage = 55,
     int range = 3)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 7
0
 public Bow(
     string weaponType = "Bow",
     WeaponHandling weaponHandling = WeaponHandling.TwoHanded,
     int damage = 50,
     int range = 6)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 8
0
 public Crossbow(
     string weaponType = "Crossbow",
     WeaponHandling weaponHandling = WeaponHandling.TwoHanded,
     int damage = 60,
     int range = 5)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 9
0
 public WarAxe(
     string weaponType = "War Axe",
     WeaponHandling weaponHandling = WeaponHandling.TwoHanded,
     int damage = 65,
     int range = 3)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 10
0
 public Hatchet(
     string weaponType = "Hatchet", 
     WeaponHandling weaponHandling = WeaponHandling.OneHanded, 
     int damage = 60, 
     int range = 2)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 11
0
 public Wand(
     string weaponType = "Wand", 
     WeaponHandling weaponHandling = WeaponHandling.OneHanded, 
     int damage = 70, 
     int range = 7)
     : base(weaponType, weaponHandling, damage, range)
 {
 }
Esempio n. 12
0
    void Die()
    {
        WeaponHandling player = this.GetComponent <WeaponHandling>();

        player.dropWeapon();
        this.setLost(true);
        this.GetComponent <CapsuleCollider>().direction = 0;
        Destroy(this.gameObject, 6);
    }
Esempio n. 13
0
    void Dies()
    {
        WeaponHandling player = this.GetComponent <WeaponHandling>();

        player.dropWeapon();
        this.setLost(true);
        GameObject Ragdoll = Instantiate(ragdoll, this.transform.position, this.transform.rotation);

        Ragdoll.SetActive(true);
        this.gameObject.SetActive(false);
        Destroy(this.gameObject, 6);
    }
Esempio n. 14
0
 private void CheckHealth()
 {
     if (this.Healthpoints <= 0)
     {
         if (this.GetComponent <FlyBehaviour>().fly == true)
         {
             this.GetComponent <NetwrokBehaviour>().FreezePlayer();
             this.GetComponent <PlayerUI>().ScoreBoard.SetActive(true);
             GameManager.instance.Lose();
             WeaponHandling player = this.GetComponent <WeaponHandling>();
             player.dropWeapon();
             this.setLost(true);
             GameObject Ragdoll = Instantiate(ragdoll, this.transform.position, this.transform.rotation);
             Ragdoll.SetActive(true);
             SpectateTeamMate();
             Destroy(this.gameObject, 1);
             if (isServer)
             {
                 RpcDies();
             }
             else
             {
                 CmdDies();
             }
         }
         else
         {
             anim.SetTrigger("Death");
             GameManager.instance.Lose();
             Die();
             if (isServer)
             {
                 RpcDie();
             }
             else
             {
                 CmdDie();
             }
             this.GetComponent <NetwrokBehaviour>().FreezePlayer();
             this.GetComponent <PlayerUI>().ScoreBoard.SetActive(true);
             StartCoroutine(DelaySeconds());
         }
     }
 }
    public void fire(FireProps fp, WeaponHandling wh)
    {
        transform.position = fp.position;
        this.wh = wh;
        nullAllAnimBools();
        animator.SetBool("returnToOrig", true);
        nullAllAnimBools();
        animator.SetBool("startTank", true);
        hp = 100;
        fireProps = fp;
        update = true;
        exClicks = wb.existingClicks;
        wh.shootingEnabled = false;
        oldSpeed = playerBase.speed;
        playerBase.speed = fp.bulletSpeed;

        //playerBase.gameObject.GetComponent<Collider2D>().enabled = false;
        GetComponent<Collider2D>().enabled = true;
    }
    public void fire(FireProps fp, WeaponHandling wh)
    {
        transform.position = fp.position;
        this.wh            = wh;
        nullAllAnimBools();
        animator.SetBool("returnToOrig", true);
        nullAllAnimBools();
        animator.SetBool("startTank", true);
        hp                 = 100;
        fireProps          = fp;
        update             = true;
        exClicks           = wb.existingClicks;
        wh.shootingEnabled = false;
        oldSpeed           = playerBase.speed;
        playerBase.speed   = fp.bulletSpeed;

        //playerBase.gameObject.GetComponent<Collider2D>().enabled = false;
        GetComponent <Collider2D>().enabled = true;
    }
Esempio n. 17
0
    public void setUpPB(Components c, PlayerInfo p)
    {
        lifes = p.lifes;
        score = 0;

        comp           = c;
        playInfo       = p;
        weaponHandling = GetComponent <WeaponHandling>();

        setUpSprites();

        setUpSounds();

        weaponHandling.buletManager = transform.parent.GetComponent <BulletManager>();
        weaponHandling.buletManager.createBullets(this);

        characterAnimator = GetComponent <Animator>();

        //pičovina, pak to napojím na PLayerInfo a atribut playerNumber uplně smažu
        playerNumber = p.playerNumber;

        mapMinX   = -4.75f;
        mapMinY   = -4.75f;
        mapMaxX   = 8.6f;
        mapMaxY   = 4f;
        mapHeight = Math.Abs(mapMaxY - mapMinY);
        mapWidth  = Math.Abs(mapMaxX - mapMinX);

        directionMapping.Add(up, 3);
        directionMapping.Add(down, 0);
        directionMapping.Add(left, 1);
        directionMapping.Add(right, 2);

        handsRenderer = transform.Find("hands_down").GetComponent <SpriteRenderer>(); //hands_down, protože sem zrovna na prefab přetáhl hands_down a nejde to změnit..normálně
        handsSprites  = Resources.LoadAll <Sprite>("Sprites/Hands");

        weaponHandling.weaponRenderer = transform.Find("weapon").GetComponent <SpriteRenderer>();

        //setup position generator
        posGenerator = GameObject.Find("PositionGenerator").GetComponent <PositionGenerator>();

        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
    }
Esempio n. 18
0
    public void SetUp(PlayerBase p)
    {
        player         = p;
        weaponHandling = p.weaponHandling;
        color          = p.playInfo.playerColor;
        playerColor    = (Colors)Enum.Parse(typeof(Colors), UppercaseFirst(color));

        sprite = p.playInfo.charEnum.ToString() + "_portrait";
        sprite = sprite.ToLower();
        SetupAvatar(sprite);
        ready = true;

        //name = GameObject.Find("name_"+color).GetComponent<Text>();
        //hp = GameObject.Find("hp_" + color).GetComponent<Text>();
        //ammo = GameObject.Find("ammo_" + color).GetComponent<Text>();

        //name.text = p.playInfo.playerName;

        iconRenderer        = transform.Find("weaponI_" + p.playInfo.playerColor).gameObject.GetComponent <SpriteRenderer>();
        iconRenderer.sprite = Resources.Load <Sprite>("Sprites/HUD/" + "icon_" + p.playInfo.charEnum.ToString().ToLower() + "Pistol");
    }
Esempio n. 19
0
    public void SetUp(PlayerBase p)
    {
        player = p;
        weaponHandling = p.weaponHandling;
        color = p.playInfo.playerColor;
        playerColor = (Colors)Enum.Parse(typeof(Colors), UppercaseFirst(color));

        sprite = p.playInfo.charEnum.ToString() + "_portrait";
        sprite = sprite.ToLower();
        SetupAvatar(sprite);
        ready = true;

        //name = GameObject.Find("name_"+color).GetComponent<Text>();
        //hp = GameObject.Find("hp_" + color).GetComponent<Text>();
        //ammo = GameObject.Find("ammo_" + color).GetComponent<Text>();

        //name.text = p.playInfo.playerName;

        iconRenderer = transform.Find("weaponI_" + p.playInfo.playerColor).gameObject.GetComponent<SpriteRenderer>();
        iconRenderer.sprite = Resources.Load<Sprite>("Sprites/HUD/" + "icon_" + p.playInfo.charEnum.ToString().ToLower() + "Pistol");
    }
Esempio n. 20
0
    private void OnCollisionStay(Collision collision) // Die by car run over
    {
        float minimumCollisionForce = 10f;

        if (this.gameObject.tag == "Player" && collision.gameObject.tag == "DriverPlayer" && collision.relativeVelocity.magnitude > minimumCollisionForce)
        {
            if (hasDefened)
            {
                hasDefened = false;
                return;
            }
            this.gameObject.GetComponent <Rigidbody>().constraints     = RigidbodyConstraints.FreezePositionY;
            this.gameObject.GetComponent <CapsuleCollider>().isTrigger = true;
            if (!isLocalPlayer)
            {
                return;
            }
            this.GetComponent <NetwrokBehaviour>().FreezePlayer();
            this.GetComponent <PlayerUI>().ScoreBoard.SetActive(true);
            GameManager.instance.Lose();
            WeaponHandling player = this.GetComponent <WeaponHandling>();
            player.dropWeapon();
            this.setLost(true);
            GameObject Ragdoll = Instantiate(ragdoll, this.transform.position, this.transform.rotation);
            Ragdoll.SetActive(true);
            SpectateTeamMate();
            Destroy(this.gameObject, 1);
            if (isServer)
            {
                RpcDies();
            }
            else
            {
                CmdDies();
            }
        }
    }
Esempio n. 21
0
    public void setUpPB(Components c, PlayerInfo p)
    {
        lifes = p.lifes;
        score = 0;

        comp = c;
        playInfo = p;
        weaponHandling = GetComponent<WeaponHandling>();

        setUpSprites();

        setUpSounds();

        weaponHandling.buletManager = transform.parent.GetComponent<BulletManager>();
        weaponHandling.buletManager.createBullets(this);

        characterAnimator = GetComponent<Animator>();

        //pičovina, pak to napojím na PLayerInfo a atribut playerNumber uplně smažu
        playerNumber = p.playerNumber;

        mapMinX = -4.75f;
        mapMinY = -4.75f;
        mapMaxX = 8.6f;
        mapMaxY = 4f;
        mapHeight = Math.Abs(mapMaxY - mapMinY);
        mapWidth = Math.Abs(mapMaxX - mapMinX);

        directionMapping.Add(up, 3);
        directionMapping.Add(down, 0);
        directionMapping.Add(left, 1);
        directionMapping.Add(right, 2);

        handsRenderer = transform.Find("hands_down").GetComponent<SpriteRenderer>(); //hands_down, protože sem zrovna na prefab přetáhl hands_down a nejde to změnit..normálně
        handsSprites = Resources.LoadAll<Sprite>("Sprites/Hands");

        weaponHandling.weaponRenderer = transform.Find("weapon").GetComponent<SpriteRenderer>();

        //setup position generator
        posGenerator = GameObject.Find("PositionGenerator").GetComponent<PositionGenerator>();

        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    }
Esempio n. 22
0
    /*private GameObject obj;
     * public GameObject getobj()
     * {
     *  return obj;
     * }*/
    public void ShootWeapon(int weapon)
    {
        // Check conditions to shoot.
        if (!isAiming || isAimBlocked || behaviourManager.GetAnim.GetBool(reloadBool) || !weapons[weapon].Shoot())
        {
            return;
        }

        else
        {
            // Update parameters: burst count, trigger for animation, crosshair change and recoil camera bounce.
            burstShotCount++;
            anim.SetTrigger(shootingTrigger);
            aimBehaviour.crosshair = shootCrosshair;
            behaviourManager.GetCamScript.BounceVertical(weapons[weapon].recoilAngle);
            if (WeaponHandle)
            {
                WeaponHandle.playsound();
            }
            else
            {
                WeaponHandle = this.GetComponent <WeaponHandling>();
                WeaponHandle.playsound();
            }

            /*
             * // Cast the shot to find a target.
             * Vector3 imprecision = Random.Range(-shotErrorRate, shotErrorRate) * behaviourManager.playerCamera.right;
             * Ray ray = new Ray(behaviourManager.playerCamera.position, behaviourManager.playerCamera.forward + imprecision);
             * RaycastHit hit = default(RaycastHit);
             * // Target was hit.
             * if (Physics.Raycast(ray, out hit, 1000f, shotMask))
             * {
             *
             *  if (hit.collider.transform != this.transform)
             *  {
             *      // Handle shot effects on target.
             *      DrawShoot(weapons[weapon].gameObject, hit.point, hit.normal, hit.collider.transform);
             *
             *      // Call the damage behaviour of target if exists.
             *       if (hit.collider.gameObject.GetComponent<HealthManager>())
             *       {
             *           hit.collider.gameObject.GetComponent<HealthManager>().TakeDamage(hit.point, ray.direction, weapons[weapon].bulletDamage);
             *       }
             *  }
             * }
             * // No target was hit.
             * else
             * {
             *
             *  Vector3 destination = (ray.direction * 500f) - ray.origin;
             *  // Handle shot effects without a specific target.
             *  DrawShoot(weapons[weapon].gameObject, destination, Vector3.up, null, false, false);
             * }*/

            //AudioSource.PlayClipAtPoint(weapons[weapon].shotSound, gunMuzzle.transform.position,0.5f);

            // Reset shot lifetime.
            shotDecay = originalShotDecay;
        }
    }