상속: MonoBehaviour
예제 #1
0
    private void ShootSound(weapon weapon_type)
    {
        string sound_path = "event:/SX/Weapons/Sx_revolver_fire";

        switch (weapon_type)
        {
        case weapon.revolver: sound_path = "event:/SX/Weapons/Revolver/Sx_revolver_fire"; break;

        case weapon.shotgun: sound_path = "event:/SX/Weapons/Shotgun/Sx_shotgun_fire"; break;

        case weapon.chaingun: sound_path = "event:/SX/Weapons/Chaingun/Sx_chaingun_fire"; break;

        case weapon.grenadeLauncher: sound_path = "event:/SX/Weapons/Hand Mortar/Sx_handMortar_fire"; break;

        case weapon.lightningGun: sound_path = "event:/SX/Weapons/Railgun/Sx_railgun_fire"; break;

        case weapon.rocketLauncher: sound_path = "event:/SX/Weapons/Rocket Launcher/Sx_rocketlauncher_fire"; break;

        case weapon.rocketFist: sound_path = "event:/SX/Player/Small/Sx_Player_melee2"; break;

        case weapon.meleeFist: sound_path = "event:/SX/Player/Small/Sx_Player_melee2"; break;

        case weapon.meleeBlade: sound_path = "event:/SX/Player/Small/Sx_Player_melee2"; break;
        }

        FMODUnity.RuntimeManager.PlayOneShotAttached(sound_path, this.gameObject);
    }
예제 #2
0
        static void start()
        {
            int    maxHealth    = 100;
            int    health       = 100;
            weapon playerWeapon = new weapon("fists", 10, 0, -1);

            inventory.Add(playerWeapon);
            weapon irradiatedClub = new weapon("irradiated club", 1, 0, 5);

            Console.Clear();
            Print("You wake in a world unlike your own.");
            Thread.Sleep(1000);
            Print("It's surfaces ravaged by radiation and disease");
            Thread.Sleep(1000);
            Console.Clear();
            Print("Before you can even take a breath an irradiated barbarian slams his club beside your head with a thump.");
            Thread.Sleep(1000);
            combat(10, ref irradiatedClub, maxHealth, ref health, ref playerWeapon);
            Console.Clear();
            Print("you put the pour creature out of it's missery with one mighty punch. It was only a child.");
            Print("you notice a potion and the club he slammed beside your head laying beside his sad corpse and decide to pick them up.");
            Thread.Sleep(2000);
            Console.Clear();
            Print("you decide to continue on and forget the horrors you have committed in an attempt to keep your tragic life.");
            Thread.Sleep(2000);
            Print("not before long you are met with another barbarian, this one much larger much stronger...");
            Thread.Sleep(2000);
            weapon largerIrradiatedClub = new weapon("irradiated club", 50, 25, 50);

            Print("you remember that you picked up a miysterious potion of the last one as well as it's weapon.");
            Thread.Sleep(1000);
            combat(100, ref largerIrradiatedClub, maxHealth, ref health, ref playerWeapon);
            Print("although defeated, you decide the world would be better off without you.");
        }
    public override bool blockDamage(int amount, weapon source)
    {
        if (fireCount >= overheatCapacity) {
            print ("Laser array overheated");
            return false;
        }
        bool blocked = false;
        int damage = amount;

        if (source.getTechnology() == "explosive" && source.getName() != "Mine") {
            blocked = true;
            damage = source.getSplashDamage();
            this.getMaster().takeDamage(damage);
        }else if (source.getTechnology() == "momentum"){
            blocked = true;
            damage = 0;
        }
        if (blocked) {
            print ("Reduced damage from " + amount.ToString () + " to " + damage.ToString () + "!");
        } else {
            print ("Block failed!");
        }
        fireCount += 1;
        firedInTurn = true;
        return blocked;
    }
예제 #4
0
    public static weapon GetRandomWeapon()
    {
        int id = Random.Range(0, repositoryNow.allWeapons.Count);
        weapon wp = repositoryNow.allWeapons[id];

        return GetWeapon(wp);
    }
예제 #5
0
    public void Initialise(int[] count)
    {
        weapons = new weapon[30];
        if (count == null)
        {
            count = new int[weapons.Length];
        }
        int index = 0;

        #region autoClickers
        //                          Weapon Type             Name                Damage      Cost        Index
        weapons[index] = new weapon(WeaponType.AutoClicker, "Drone Bomber", 2.0f, 50.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.AutoClicker, "Orbital Cannon", 16.0f, 300.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.AutoClicker, "Solar Array", 128.0f, 1500.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.AutoClicker, "Elon Star", 2048.0f, 900000.0f, count[index++]);
        #endregion
        #region oneOffWeapons
        weapons[index] = new weapon(WeaponType.PlayerWeapon, "Edison Car", 8.0f, 50.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.PlayerWeapon, "SpaceY Rocket", 64.0f, 200.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.PlayerWeapon, "Asteroid Strike", 128.0f, 1000.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.PlayerWeapon, "Nuclear Bomb", 256.0f, 5000.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.PlayerWeapon, "Fusion Bomb", 1024.0f, 25000.0f, count[index++]);
        weapons[index] = new weapon(WeaponType.PlayerWeapon, "Space Ripper", 2048.0f, 100000.0f, count[index++]);
        #endregion
    }
예제 #6
0
    void selectWeapon()
    {
        int i = 0;

        foreach (var gun in weapons)
        {
            if (i == selectedWeapon)
            {
                currentclipsize        = gun.clipSize;
                currentroundsavailable = gun.roundsAvailable;
                currentdamage          = gun.dmg;
                spreadnum = gun.spread;

                ROF = gun.rateOfFire;
                currentreloadtime = gun.reloadTime;
                spreadangle       = gun.spreadAngle;

                currentWeapon       = weapons[i];
                currentWeaponString = weapons[i].name;
            }


            i++;
        }
    }
예제 #7
0
    void shoot()
    {
        Vector3    direction = wp_obj.transform.forward;
        Ray        ray       = new Ray(wp_obj.transform.position, direction);
        RaycastHit result;
        weapon     current_weapon = weapons[index];

        if (Physics.Raycast(ray, out result, current_weapon.range))
        {
            if (result.collider.gameObject.CompareTag("Zombie"))
            {
                zombie_manager zb_manager = result.collider.gameObject.GetComponent <zombie_manager>();
                if (zb_manager.deal_damages(weapons[index].damages))
                {
                    dc.st.add_points(zb_manager.stats.diffuculty * 10);
                }
                else
                {
                    dc.st.add_points(1);
                }
                dc.ui.refresh_points();
            }
            Debug.Log("touché");
            draw_shot(wp_obj.transform.position, result.point);
        }
        else
        {
            draw_shot(wp_obj.transform.position, wp_obj.transform.position + wp_obj.transform.forward * 100);
        }
        current_weapon.clip_ammo--;
        dc.ui.refresh_weapon();
    }
    public void Fire(weapon a)
    {
        Fired = true;
        GameObject bulletEffectInstance = Instantiate(a.bulletLaunchEffect, turretEnd.transform.position, turretEnd.transform.rotation);

        bulletEffectInstance.transform.parent = turretEnd.transform;
        Rigidbody bulletInstance;

        bulletInstance = Instantiate(a.bullet, turretEnd.transform.position, turret.transform.rotation) as Rigidbody;
        bulletInstance.AddForce(turretEnd.transform.right * Random.Range(a.FireMinForce, a.FireMaxForce));
        ChargeProgress = 0;
        if (a.IfBulletShake)
        {
            BulletShake();
        }

        if (a.IfShotGun)
        {
            for (int i = 0; i < a.shotgunNum; i++)
            {
                Rigidbody ShotgunInstance;
                ShotgunInstance = Instantiate(a.bullet, ShotGunEnd[i].transform.position, ShotGunEnd[i].transform.rotation) as Rigidbody;
                ShotgunInstance.AddForce(ShotGunEnd[i].transform.forward * Random.Range(a.FireMinForce, a.FireMaxForce));
            }
        }
    }
예제 #9
0
 public void setSelectedWeapon(string name)
 {
     foreach (weapon wep in weapons)
     {
         if (wep != null && wep.name == name)
         {
             if (selectedWeapon == wep)
             {
                 selectedWeapon = null;
             }
             else
             {
                 selectedWeapon = wep;
             }
         }
     }
     foreach (SelectWeaponScript button in weaponButtons)
     {
         if (button.weaponName == name && selectedWeapon != null)
         {
             button.SetSelected();
         }
         else
         {
             button.SetDeselected();
         }
     }
 }
예제 #10
0
파일: player.cs 프로젝트: jspezia/Unity
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && _weaponSelected != null) {
            AudioSource.PlayClipAtPoint(fire, Vector3.up);
        }
        if (Input.GetKeyDown(KeyCode.E) && _weaponSelected == null) {
            _colSelected = Physics2D.OverlapPoint(transform.position);
            if (_colSelected && _colSelected.tag == "weapon") {
                AudioSource.PlayClipAtPoint(reload, Vector3.up);
                _weaponSelected = _colSelected.gameObject.GetComponent<generateWeapon>();
                anim = _weaponSelected.GetComponent<Animator>();
                _weapon = _weaponSelected.weapon.GetComponent<weapons>();
                attachToBody.GetComponent<SpriteRenderer>().sprite = _weapon.attachToBody;
                weapon2 = weapon.GetComponent<weapon>();
                bullet_prefab = weapon.GetComponent<weapon>().bullet_prefab;
                bullet_prefab.GetComponent<SpriteRenderer>().sprite = weapon2.bullets[_weaponSelected.i];

                _weaponSelected.transform.localScale = Vector3.zero;

                anim.SetBool("isTake", true);
                anim.SetBool("isDrop", false);

            }
        }

        if (Input.GetMouseButtonDown (1) && _weaponSelected != null) {
            anim.SetBool("isTake", false);
            anim.SetBool("isDrop", true);
            _weaponSelected.transform.position = transform.position;
            attachToBody.GetComponent<SpriteRenderer>().sprite = null;

            _weaponSelected = null;
        }
    }
    void Start()
    {
        if (primaryWeapon)
        {
            GameObject primary = Instantiate(primaryWeapon, transform.position, Quaternion.identity) as GameObject;
            primary.transform.SetParent(transform);
            primary.transform.rotation = primary.transform.parent.rotation;

            currentPrimary = primary.GetComponent<weapon>();
        }
        if (secondaryWeapon)
        {
            GameObject secondary = Instantiate(secondaryWeapon, transform.position, Quaternion.identity) as GameObject;
            secondary.transform.SetParent(transform);
            secondary.transform.rotation = secondary.transform.parent.rotation;

            currentSecondary = secondary.GetComponent<weapon>();

        }
        if (bombWeapon)
        {
            GameObject bomb = Instantiate(bombWeapon, transform.position, Quaternion.identity) as GameObject;
            bomb.transform.SetParent(transform);
            bomb.transform.rotation = bomb.transform.parent.rotation;
        }
    }
예제 #12
0
    public void refresh_weapon()
    {
        weapon cur_wp = dc.wp_man.weapons[dc.wp_man.index];

        weapon_name_text.text = cur_wp.Name;
        ammo_text.text        = cur_wp.clip_ammo + " / " + dc.wp_man.ammos[cur_wp.type];
    }
예제 #13
0
        private void WeaponCollision()
        {
            foreach (InteractiveObject w in map.weaponList)
            {
                if (hitBox.Intersects(w.interactHitBox) && !w.isInteracted && currentKeyboardState.IsKeyDown(Keys.E) && !previousKeyboardState.IsKeyDown(Keys.E))
                {
                    w.isInteracted = true;
                    int weaponType = w.myIdentifier();
                    DropCurrentWeapon();

                    if (weaponType == 1)
                    {
                        activeWeapon = weapon.assaultRifle;
                        ammoCount    = 30;
                    }
                    if (weaponType == 2)
                    {
                        activeWeapon = weapon.sniperRifle;
                        ammoCount    = 5;
                    }
                    if (weaponType == 3)
                    {
                        activeWeapon = weapon.pistol;
                        ammoCount    = 8;
                    }

                    CheckActiveWeapon();
                    break;
                }
            }
        }
예제 #14
0
    private void PickupSound(weapon weapon_type)
    {
        string sound_path = "event:/SX/Weapons/Sx_revolver_pickup";

        switch (weapon_type)
        {
        case weapon.revolver: sound_path = "event:/SX/Weapons/Revolver/Sx_revolver_pickup"; break;

        case weapon.shotgun: sound_path = "event:/SX/Weapons/Shotgun/Sx_shotgun_pickup"; break;

        case weapon.chaingun: sound_path = "event:/SX/Weapons/Chaingun/Sx_chaingun_pickup"; break;

        case weapon.grenadeLauncher: sound_path = "event:/SX/Weapons/Hand Mortar/Sx_handMortar_pickup"; break;

        case weapon.lightningGun: sound_path = "event:/SX/Weapons/Railgun/Sx_railgun_pickup"; break;

        case weapon.rocketLauncher: sound_path = "event:/SX/Weapons/Rocket Launcher/Sx_rocketlauncher_pickup"; break;

        case weapon.rocketFist: sound_path = "event:/SX/Weapons/Sx_revolver_pickup"; break;

        case weapon.meleeFist: sound_path = "event:/SX/Weapons/Sx_revolver_pickup"; break;

        case weapon.meleeBlade: sound_path = "event:/SX/Weapons/Sx_revolver_pickup"; break;
        }

        FMODUnity.RuntimeManager.PlayOneShot(sound_path, this.transform.position);
    }
예제 #15
0
    private void EmptySound(weapon weapon_type)
    {
        //KostinKoodi
        //WeaponFireSound = FMODUnity.RuntimeManager.CreateInstance(sound_path);

        string sound_path = "event:/SX/Weapons/Sx_revolver_empty";

        switch (weapon_type)
        {
        case weapon.revolver: sound_path = "event:/SX/Weapons/Revolver/Sx_revolver_empty"; break;

        case weapon.shotgun: sound_path = "event:/SX/Weapons/Shotgun/Sx_shotgun_empty"; break;

        case weapon.chaingun: sound_path = "event:/SX/Weapons/Chaingun/Sx_chaingun_empty"; break;

        case weapon.grenadeLauncher: sound_path = "event:/SX/Weapons/Hand Mortar/Sx_handMortar_empty"; break;

        case weapon.lightningGun: sound_path = "event:/SX/Weapons/Railgun/Sx_railgun_empty"; break;

        case weapon.rocketLauncher: sound_path = "event:/SX/Weapons/Rocket Launcher/Sx_rocketlauncher_empty"; break;

        case weapon.rocketFist: sound_path = "event:/SX/Weapons/Sx_revolver_empty"; break;

        case weapon.meleeFist: sound_path = "event:/SX/Weapons/Sx_revolver_empty"; break;

        case weapon.meleeBlade: sound_path = "event:/SX/Weapons/Sx_revolver_empty"; break;
        }

        FMODUnity.RuntimeManager.PlayOneShotAttached(sound_path, this.gameObject);
    }
        public static Weapon GetWeaponByName(string name)
        {
            WeaponService _weaponService = new WeaponService(EquipmentGlobals.ConnectionString);
            weapon        tempWeapon     = _weaponService.GetWeaponByName(name);

            return(MapThisToWeaponObject(tempWeapon));
        }
예제 #17
0
    public void ReadQuestData()
    {
        for (int i = 0; i < Database.ItemData ["Weapons"].Count; i++)
        {
            weapon newWeapon = new weapon();
            newWeapon.name         = (string)Database.ItemData ["Weapons"][i]["name"];
            newWeapon.ID           = (int)Database.ItemData ["Weapons"] [i] ["itemID"];
            newWeapon.attackDamage = (int)Database.ItemData ["Weapons"] [i] ["attackDamage"];
            newWeapon.attackSpeed  = (int)Database.ItemData ["Weapons"] [i] ["attackSpeed"];
            newWeapon.description  = (string)Database.ItemData ["Weapons"] [i] ["description"];
            newWeapon.slug         = (string)Database.ItemData ["Weapons"] [i] ["slug"];
            newWeapon.stackable    = (bool)Database.ItemData ["Weapons"] [i] ["stackable"];
            newWeapon.value        = (int)Database.ItemData ["Weapons"] [i] ["value"];
            weaponList.Add(newWeapon);
        }

        for (int i = 0; i < Database.ItemData ["Shield"].Count; i++)
        {
            Shield newShield = new Shield();
            newShield.name          = (string)Database.ItemData ["Shield"][i]["name"];
            newShield.ID            = (int)Database.ItemData ["Shield"] [i] ["itemID"];
            newShield.shieldDefence = (int)Database.ItemData ["Shield"] [i] ["armorDefence"];
            newShield.shieldHealth  = (int)Database.ItemData ["Shield"] [i] ["armorHealth"];
            newShield.description   = (string)Database.ItemData ["Shield"] [i] ["description"];
            newShield.stackable     = (bool)Database.ItemData ["Shield"] [i] ["stackable"];
            newShield.slug          = (string)Database.ItemData ["Shield"] [i] ["slug"];
            newShield.value         = (int)Database.ItemData ["Shield"] [i] ["value"];
            shieldList.Add(newShield);
        }
    }
예제 #18
0
    void activateItem(String name, Vector2 moveVector)
    {
        //activate beacon on character
        if (name == "beacon" || name == "beacon(Clone)")
        {
            go = Instantiate(item[0], rb2d.position, Quaternion.identity);
            go.transform.parent = gameObject.transform;
        }

        //need to finish code to activate other items
        if (name == "shield" || name == "shield(Clone)")
        {
            GameObject go = Instantiate(item[1], rb2d.position, Quaternion.identity);
            go.transform.parent      = gameObject.transform;
            go.transform.localScale += new Vector3(0.3f, 0.3f, 0);
            shield = true;
        }
        if (name == "landmine" || name == "landmine(Clone)")
        {
            weapon playerWeapon = player.GetComponent <weapon>();
            playerWeapon.numberMines += 3;
        }

//		Debug.Log(name);


        inventory.RemoveAt(0);
    }
예제 #19
0
 public void Reset()
 {
     this.currentFacing = facing.right;
     this.currentWeapon = weapon.None;
     this.currentStatus = status.standing;
     this.currentSprite = new LinkNoneStandingRightSprite();
 }
예제 #20
0
    private void OnMessageType_ServerPlayerAttack(byte userID, byte[] data)
    {
        byte   weaponID   = data[0];
        weapon weaponName = NetworkPlayer.CastByteToWeaponName(weaponID);

        MultiplayerSceneProperties.Instance.ActionsQue.Add(userID, PlayerActionQue.PlayerActions.Attack, weaponName);
    }
예제 #21
0
    public static byte CastWeaponNameToByte(weapon w)
    {
        switch (w)
        {
        case weapon.empty:              return(0);

        case weapon.revolver:           return(1);

        case weapon.chaingun:           return(2);

        case weapon.rocketLauncher:     return(3);

        case weapon.grenadeLauncher:    return(4);

        case weapon.shotgun:            return(5);

        case weapon.lightningGun:       return(6);

        case weapon.rocketFist:         return(7);

        case weapon.meleeFist:          return(8);

        case weapon.meleeBlade:         return(9);

        case weapon.total:              return(10);

        default:
            return(0);
        }
    }
예제 #22
0
 void Awake()
 {
     Instance       = this;
     ani            = GetComponentInParent <Animator>();
     PlayerWeaponPV = GetComponent <PhotonView>();
     AS             = GetComponent <AudioSource>();
 }
예제 #23
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        //Debug.Log(hitInfo.name);

        if (hitInfo.name == "beacon" || hitInfo.name == "flamegun" || hitInfo.name == "shield" || hitInfo.name == "landmine" || hitInfo.name == "newFlare(Clone)" || hitInfo.name == "newFlare 1(Clone)")
        {
            //if bullets collides with items or other bullets, let it pass through
        }
        else
        {
            //if it hits an object set bullet speed to 0
            //Debug.Log(rb.velocity);
            rb.velocity = Vector3.zero;
        }

        if (hitInfo.name == "Fire")
        {
            //when the bullet makes contact with mine explosion get rid of it.
            Destroy(gameObject);
            GameObject player1 = GameObject.Find("player1");
            weapon     wp      = player1.GetComponent <weapon>();

            GameObject[]       objs     = GameObject.FindGameObjectsWithTag("globalSettings");
            GlobalMenuSettings settings = objs[0].GetComponent <GlobalMenuSettings>();

            if (wp.numberBullets < settings.bullets)
            {
                wp.numberBullets += 1;
            }
        }
    }
예제 #24
0
    void Update()
    {
        timeLeft -= Time.deltaTime;

        //get the velocity of the bullet
        //float x = Math.Abs(rb.velocity.x);
        //float y = Math.Abs(rb.velocity.y);

        //start the 5 second countdown for each individual bullet fired, after 5 seconds object will be destroyed.
        if (timeLeft <= 0)
        {
            GameObject player1 = GameObject.Find("player1");
            weapon     wp      = player1.GetComponent <weapon>();

            GameObject[]       objs     = GameObject.FindGameObjectsWithTag("globalSettings");
            GlobalMenuSettings settings = objs[0].GetComponent <GlobalMenuSettings>();

            if (wp.numberBullets < settings.bullets)
            {
                wp.numberBullets += 1;
            }

            Destroy(gameObject);
        }
    }
예제 #25
0
        // Start is called before the first frame update
        private void Start()
        {
            selected = PlayerPrefs.GetInt("Selcted");

            player2 = Player.GetComponent <weapon>();

            timetillnextmultshot = player2.timetillnextmultshot;
        }
예제 #26
0
 void Start()
 {
     SpriteRenderer[] renders = GetComponentsInChildren<SpriteRenderer>();
     renders[0].sprite = heads[Random.Range(0, heads.GetLength(0))];
     renders[1].sprite = body[Random.Range(0, body.GetLength(0))];
     _weapon = GameObject.Instantiate(this.weponsChoice[Random.Range(0, this.weponsChoice.GetLength(0) - 1)]);
     StartCoroutine (this.initWeapon ());
 }
예제 #27
0
 public P1State()// 可能不需要parameter因为P1里面有P1State,P1State里面也不需要P1
 {
     //initial
     currentFacing = facing.right;
     currentWeapon = weapon.None;
     currentStatus = status.standing;
     currentSprite = new LinkNoneStandingRightSprite();
 }
예제 #28
0
    // Update is called once per frame
    void Update()
    {
        if (currentWeapon != lastWeapon)
        {
            if (lastWeapon == weapon.empty)
            {
                gunSwapCooldown = animController.SwitchNewWeapon();
            }
            else
            {
                gunSwapCooldown = animController.SwitchWeapon();
            }

            secondaryCooldown = gunSwapCooldown;
            secondaryTimer    = 0;
            gunSwapTimer      = 0;
            lastWeapon        = currentWeapon;
        }
        if (gunSwapCooldown != 0)
        {
            if (gunSwapTimer < gunSwapCooldown / 2)
            {
                gunSwapTimer += Time.deltaTime;
            }
            else
            {
                spriteAnim.pauseCounter = true;
                //spriteAnim.idleTimeBetweenAnimFrames = gunsDict[currentWeapon].idleTimeBetweenAnim;
                spriteAnim.shootTimeBetweenAnimFrames = gunsDict[currentWeapon].shootTimeBetweenAnim;
                spriteAnim.idleTextures    = gunsDict[currentWeapon].idleTexture;
                spriteAnim.idleNormals     = gunsDict[currentWeapon].idleNormal;
                spriteAnim.idleEmissions   = gunsDict[currentWeapon].idleEmission;
                spriteAnim.idleMetallics   = gunsDict[currentWeapon].idleMetallic;
                spriteAnim.idleOcclusions  = gunsDict[currentWeapon].idleOcclusion;
                spriteAnim.shootTextures   = gunsDict[currentWeapon].shootTexture;
                spriteAnim.shootNormals    = gunsDict[currentWeapon].shootNormal;
                spriteAnim.shootEmissions  = gunsDict[currentWeapon].shootEmission;
                spriteAnim.shootMetallics  = gunsDict[currentWeapon].shootMetallic;
                spriteAnim.shootOcclusions = gunsDict[currentWeapon].shootOcclusion;
                spriteAnim.LoadTextures();
                gunSwapCooldown = 0;
                gunSwapTimer    = 0;
            }
        }
        if (secondaryCooldown != 0)
        {
            if (secondaryTimer < secondaryCooldown)
            {
                secondaryTimer += Time.deltaTime;
            }
            else
            {
                animController.switchingWeapon = false;
                secondaryTimer    = 0;
                secondaryCooldown = 0;
            }
        }
    }
예제 #29
0
 private void OnEnable()
 {
     if (weaponNow1)
     {
         SetWeapon(null);
         weapon wp = repository.GetRandomWeapon();
         SetWeapon(wp);
     }
 }
예제 #30
0
    void OnMouseDown()
    {
        GameManager gameManager = GameObject.FindObjectOfType <GameManager>();



        if (gameManager.turret == "turret1")
        {
            if (gameManager.coin >= 5)
            {
                gameManager.Modifycoin(-5);
                turret1.SetActive(true);
                Turret1 tur1 = turret1.GetComponent <Turret1>();

                StartCoroutine(tur1.cycle());
                gameManager.HideTurret();
            }
            else
            {
                gameManager.HideTurret();
            }
        }
        else if (gameManager.turret == "turret2")
        {
            if (gameManager.coin >= 10)
            {
                gameManager.Modifycoin(-10);
                turret2.SetActive(true);
                weapon tur2 = turret2.GetComponent <weapon>();

                StartCoroutine(tur2.cycle());
                gameManager.HideTurret();
            }
            else
            {
                gameManager.HideTurret();
            }
        }
        else if (gameManager.turret == "turret3")
        {
            if (gameManager.coin >= 15)
            {
                gameManager.Modifycoin(-15);
                turret3.SetActive(true);
                Turret3 tur3 = turret3.GetComponent <Turret3>();

                StartCoroutine(tur3.cycle());
                gameManager.HideTurret();
            }
            else
            {
                gameManager.HideTurret();
            }
        }

        print("Input");
    }
예제 #31
0
    void Update()
    {
        weapon current_weapon = weapons[index];
        bool   shooting       = CrossPlatformInputManager.GetButton("Fire1");
        bool   drop           = CrossPlatformInputManager.GetButtonDown("Drop");
        float  scroll         = CrossPlatformInputManager.GetAxis("Mouse ScrollWheel");
        bool   reloading      = CrossPlatformInputManager.GetButtonDown("Reload");

        if (!photonView.isMine)
        {
            return;
        }
        if (reloading)
        {
            if (reload())
            {
                photonView.RPC("reload", PhotonTargets.All);
                time_since_last_shoot = -current_weapon.reload_time;
            }
        }
        if (current_weapon.auto)
        {
            shooting = CrossPlatformInputManager.GetButton("Fire1");
        }
        else
        {
            shooting = CrossPlatformInputManager.GetButtonDown("Fire1");
        }
        time_since_last_shoot += Time.deltaTime;
        if (shooting && time_since_last_shoot > current_weapon.get_fire_rate() && current_weapon.can_fire())
        {
            photonView.RPC("shoot", PhotonTargets.All);
            time_since_last_shoot = 0;
        }
        if (scroll > 0)
        {
            photonView.RPC("change_weapon", PhotonTargets.All, (index + 1) % weapons.Count);
        }
        else if (scroll < 0)
        {
            index = (index - 1) % weapons.Count;
            if (index < 0)
            {
                index = weapons.Count - 1;
            }
            photonView.RPC("change_weapon", PhotonTargets.All, index);
        }
        if (scroll != 0)
        {
            dc.ui.refresh_weapon();
        }
        if (drop)
        {
            photonView.RPC("drop_weapon", PhotonTargets.All);
            dc.ui.refresh_weapon();
        }
    }
예제 #32
0
    public void addWeapon()
    {
        weapon NewWeapon = new weapon();

        NewWeapon.WeaponAttack = 1;
        myWeapon.Add(NewWeapon);
        listeIndex++;
        print("addweapon");
    }
예제 #33
0
    // Start is called before the first frame update
    void Start()
    {
        rigidBody2d = gameObject.GetComponent <Rigidbody2D>();
        Debug.Log(transform.Find("/ItemList"));
        currentWeapon = weapons[currentWeaponIndex].GetComponent <weapon>();
        int i = transform.GetSiblingIndex();

        //GameObject go = GameObject.Find("/qs");
        setTargetEnermy();
    }
예제 #34
0
        static Init()
        {
            weapon testWeapon = new weapon(30, 50);

            weapon[] weaponArray1 = new weapon[3];
            for (int i = 0; i < 2; i++)
            {
                weaponArray1[i] = testWeapon;
            }
        }
 public override bool blockDamage(int amount, weapon source)
 {
     bool blocked = amount <= maxDamage;
     if (blocked) {
         print ("Reduced damage from " + amount.ToString () + " to 0!");
     } else {
         print ("Block failed!");
     }
     return blocked;
 }
 public override bool blockDamage(int amount, weapon source)
 {
     bool blocked = false;
     int damage = amount;
     if (source.getTechnology() == "explosive" && source.getName() != "Mine") {
         blocked = true;
         damage = source.getSplashDamage();
         this.getMaster().takeDamage(damage);
     }else if (source.getTechnology() == "momentum"){
         blocked = true;
         damage = Mathf.Max(0,amount - Random.Range(MIN_REDUCTION,MAX_REDUCTION + 1));
         this.getMaster().takeDamage(damage);
     }
     if (blocked) {
         print ("Reduced damage from " + amount.ToString () + " to " + damage.ToString () + "!");
     } else {
         print ("Block failed!");
     }
     return blocked;
 }
예제 #37
0
        public void shoot(Direction dir)
        {
            KeyboardState kS = Keyboard.GetState();

            if (((player_nb == 1 && kS.IsKeyDown(Keys.Space)) ||
                (player_nb == 2 && kS.IsKeyDown(Keys.RightAlt))) && isShootTimerElapsed())
            {
                if (currentWeapon == weapon.CLOUD)
                    Stage.getInstance().addElement(new Cloud(_player, dir, _player.getPosition().X, _player.getPosition().Y));
                else if (currentWeapon == weapon.FIREBALL)
                    Stage.getInstance().addElement(new Fireball(_player, dir, _player.getPosition().X, _player.getPosition().Y));
                resetShootTimer();
            }
            if (((player_nb == 1 && kS.IsKeyDown(Keys.Q)) ||
                (player_nb == 2 && kS.IsKeyDown(Keys.RightShift))) && change_weapon_timer > 800f)
            {
                change_weapon_timer = 0f;
                currentWeapon++;
                if (currentWeapon > weapon.FIREBALL)
                    currentWeapon = weapon.CLOUD;
            }
        }
예제 #38
0
    void Awake()
    {
        wep = new weapon();
        wep.objPrefab = prefabs[0];
        wep.name = "Dual Rocket";
        wep.damage = 9001;
        wep.type="rocket";
        wep.velocity=5;
        wep.accuracy=100;
        wep.nodeType=1;
        wep.id=0;
        weaponList.Add(wep);

        wep = new weapon();
        wep.objPrefab = prefabs[1];
        wep.name = "SwagCannon";
        wep.damage = 9001;
        wep.type="rocket";
        wep.velocity=5;
        wep.accuracy=100;
        wep.nodeType=1;
        wep.id=1;
        weaponList.Add(wep);

        wep = new weapon();
        wep.objPrefab = prefabs[2];
        wep.name = "yoloCannon";
        wep.damage = 9001;
        wep.type="rocket";
        wep.velocity=5;
        wep.accuracy=100;
        wep.nodeType=1;
        wep.id=2;
        weaponList.Add(wep);

        weapons = weaponList.ToArray();
    }
예제 #39
0
    void Combat()
    {
        if (!useWeapon && Input.GetKeyDown (KeyCode.F))
            weaponMode = weapon.flySword;

        if (!useWeapon && Input.GetKeyDown (KeyCode.C)) {
            if(weaponMode == weapon.sword || weaponMode == weapon.flySword)
                weaponMode = weapon.bow;
            else if (weaponMode == weapon.bow)
                weaponMode = weapon.sword;

            print (weaponMode);
        }

        if (weaponMode == weapon.sword || weaponMode == weapon.flySword) {

            // Progress the sword cooldown.
            if (swordCooldown > 0)
                swordCooldown--;
            else {
                if(weaponInstance != null){
                    if (weaponMode == weapon.sword) {
                        Destroy (weaponInstance);
                    }
                    else if (weaponMode == weapon.flySword) {
                        weaponInstance.GetComponent<Sword> ().towardDir = currentDir;
                        weaponInstance.GetComponent<Sword> ().fly = true;
                        weaponInstance = null;
                    }
                }

                weaponInstance = null;
                gameObject.GetComponent<Animator> ().SetInteger ("ver_weapon", 0);
                gameObject.GetComponent<Animator> ().SetInteger ("hor_weapon", 0);
                useWeapon = false;

            }
            if (Input.GetKeyDown (KeyCode.Space) && weaponInstance == null) {

                // Spawn the sword into being
                weaponInstance = Instantiate (swordPrefab, transform.position, Quaternion.identity) as GameObject;

                swordCooldown = 10;
                useWeapon = true;

                // Adjust sword angle and position based on current facing direction
                if (currentDir == 'n') {
                    weaponInstance.transform.position += new Vector3 (0, 1, 0);

                } else if (currentDir == 'e') {
                    weaponInstance.transform.position += new Vector3 (1, 0, 0);
                    weaponInstance.transform.Rotate (new Vector3 (0, 0, 1), 270);
                } else if (currentDir == 's') {
                    weaponInstance.transform.position += new Vector3 (0, -1, 0);
                    weaponInstance.transform.Rotate (new Vector3 (0, 0, 1), 180);
                } else if (currentDir == 'w') {
                    weaponInstance.transform.position += new Vector3 (-1, 0, 0);
                    weaponInstance.transform.Rotate (new Vector3 (0, 0, 1), 90);
                }

            }
        }
        else if ( weaponMode == weapon.bow ) {

            if(arrowCooldown == 0)
                useWeapon = false;
            else if(arrowCooldown > 0)
                arrowCooldown--;

            if(Input.GetKeyDown(KeyCode.Space) && !useWeapon) {

                // Spawn the sword into being
                GameObject weaponInstance = Instantiate(arrowPrefab, transform.position, Quaternion.identity) as GameObject;
                arrowCooldown = 3;
                useWeapon = true;

                // Adjust arrow angle and position based on current facing direction
                if(currentDir == 'n') {
                    weaponInstance.transform.position += new Vector3(0, 1, 0);
                    weaponInstance.GetComponent<Arrow>().towardDir = 'n';
                }
                else if(currentDir == 'e') {
                    weaponInstance.transform.position += new Vector3(1, 0, 0);
                    weaponInstance.transform.Rotate(new Vector3(0, 0, 1), 270);
                    weaponInstance.GetComponent<Arrow>().towardDir = 'e';
                }
                else if(currentDir == 's') {
                    weaponInstance.transform.position += new Vector3(0, -1, 0);
                    weaponInstance.transform.Rotate(new Vector3(0, 0, 1), 180);
                    weaponInstance.GetComponent<Arrow>().towardDir = 's';
                }
                else if(currentDir == 'w') {
                    weaponInstance.transform.position += new Vector3(-1, 0, 0);
                    weaponInstance.transform.Rotate(new Vector3(0, 0, 1), 90);
                    weaponInstance.GetComponent<Arrow>().towardDir = 'w';
                }

                weaponInstance = null;
            }
        }

        if (useWeapon) {
            if (currentDir == 'n') {
                gameObject.GetComponent<Animator>().SetInteger("ver_weapon", 1);
                gameObject.GetComponent<Animator>().SetInteger("hor_weapon", 0);
            }
            else if (currentDir == 's') {
                gameObject.GetComponent<Animator>().SetInteger("ver_weapon", -1);
                gameObject.GetComponent<Animator>().SetInteger("hor_weapon", 0);
            }
            else if (currentDir == 'e') {
                gameObject.GetComponent<Animator>().SetInteger("ver_weapon", 0);
                gameObject.GetComponent<Animator>().SetInteger("hor_weapon", 1);
            }
            else if (currentDir == 'w') {
                gameObject.GetComponent<Animator>().SetInteger("ver_weapon", 0);
                gameObject.GetComponent<Animator>().SetInteger("hor_weapon", -1);
            }

        }
    }
예제 #40
0
    public void LoadEquipment()
    {
        XmlDocument xmlDoc = new XmlDocument();

        string path = Application.dataPath + @"/Resources/XML/EquipmentList.xml";

        if (File.Exists(path))
        {
            xmlDoc.Load(path);

            //load weapons
            XmlNodeList weapons = xmlDoc.GetElementsByTagName("Weapon");

            foreach(XmlNode wep in weapons){
                weapon temp = new weapon();
                temp.recipe = new List<string>();
                foreach (XmlAttribute val in wep.Attributes)
                {
                    //Store values
                    if (val.Name == "name")
                        temp.name = val.InnerText;
                    else if (val.Name == "str")
                        temp.str = int.Parse(val.InnerText);
                    else if (val.Name == "end")
                        temp.end = int.Parse(val.InnerText);
                    else if (val.Name == "agi")
                        temp.agi = int.Parse(val.InnerText);
                    else if (val.Name == "mag")
                        temp.mag = int.Parse(val.InnerText);
                    else if (val.Name == "luck")
                        temp.luck = int.Parse(val.InnerText);
                    else if (val.Name == "rangemin")
                        temp.rangeMin = int.Parse(val.InnerText);
                    else if (val.Name == "rangemax")
                        temp.rangeMax = int.Parse(val.InnerText);
                    else if (val.Name.Contains("recipe"))
                        temp.recipe.Add(val.InnerText);
                }
                allWeapons.Add(temp);
            }

            //load armor
            XmlNodeList armors = xmlDoc.GetElementsByTagName("Armor");

            foreach(XmlNode arm in armors){
                armor temp2 = new armor();
                temp2.recipe = new List<string>();
                foreach (XmlAttribute val in arm.Attributes)
                {

                    //Store values
                    if (val.Name == "name")
                        temp2.name = val.InnerText;
                    else if (val.Name == "str")
                        temp2.str = int.Parse(val.InnerText);
                    else if (val.Name == "end")
                        temp2.end = int.Parse(val.InnerText);
                    else if (val.Name == "agi")
                        temp2.agi = int.Parse(val.InnerText);
                    else if (val.Name == "mag")
                        temp2.mag = int.Parse(val.InnerText);
                    else if (val.Name == "luck")
                        temp2.luck = int.Parse(val.InnerText);
                    else if (val.Name.Contains("recipe")){
                        temp2.recipe.Add(val.InnerText);
                    }
                }
                allArmor.Add(temp2);
            }
        }
    }
    void Update()
    {
        // Display energy
        if (this.playerIndex == 0) {
            GameObject.Find ("player1Energy").GetComponent<Text> ().text = PhotonNetwork.player.name + ": " +
                this.energy.ToString ();
        }
        else {
            GameObject.Find ("player2Energy").GetComponent<Text> ().text = PhotonNetwork.otherPlayers[0].name + ": " +
                this.energy.ToString ();
        }

        if (tManager.getTurn()==turn) return;
        if (tManager.getTime()==time) return;

        // Everything happens in between!
        //print ("Player Time = " + time.ToString ());
        // If we don't syncronize time first, weapons will be fired one step early
        time = tManager.getTime();
        // Start of turn
        if (time == 0){
            if (currWeapon.isPassive() && currWeapon.readyToFire()){
                currWeapon.fireWeapon(Vector2.zero,time);
            }
            // Temporary!!
            if (currWeapon.isDefeniveWeapon() && currWeapon.readyToFire()){
                defensiveWeapon = currWeapon;
            }else{
                defensiveWeapon = null;
            }
            //printMovement();
        }
        startStep ();
        // End of turn
        if (time == -1) {
            turn = tManager.getTurn ();
            //print ("Player end of turn!");
            //print("Turn:" + turn.ToString());
        }
    }
 void networkSetWeapon(int weaponIndex)
 {
     int i;
     for (i = 0; i < weaponList.Count; i++){
         if (weaponList[i] == weaponIndex){
             // Player doesn't store weapons in the order of weapon index
             if (currWeapon != weapons [i]){
                 if (currWeapon != null){currWeapon.setShotsPlanned(0);}
                 currWeapon = weapons [i];
                 if (photonView.isMine) iManager.resetCommands(playerPosition);
             }
             return;
         }
     }
 }
예제 #43
0
    void Start()
    {
        // restart game on death
        Time.timeScale = 1.0f;
        //agent = GetComponent<NavMeshAgent> ();
        //agent.updatePosition = false;
        //agent.updateRotation = false;
        //agent.Stop(true);

        //weaponsList.AddFirst (gameWeaponsList [0]);
        //weaponsList.AddFirst (gameWeaponsList [3]);

        // get saved values for health, ammo, etc from game controller
        GameController controller = (GameController) FindObjectOfType (typeof(GameController));

        if (controller.showStartingMessage) {
            controller.showStartingMessage = false;
            startingMessage = "Your car is out of gas and you are now stranded! Find 100 gas and return to the car.\n Remember to find additional supplies such as food and ammunition to help increase your chances of survival.\n Press \"Enter\" to close message.";
            showStarting = true;
        } else {
            showStarting = false;
        }

        // retrieve saved values for health, ammo, weapons
        health = controller.startingHealth;
        pistolAmmo = controller.startingPistolAmmo;
        rifleAmmo = controller.startingRifleAmmo;
        gasAmt = controller.startingGasAmt;
        weaponsInInventory = controller.startingWeaponInventory;

        if (weaponsInInventory == 7) {
            weaponsList.AddFirst (gameWeaponsList [1]);
            weaponsList.AddFirst (gameWeaponsList [2]);
            weaponsList.AddFirst (gameWeaponsList [0]);
            weaponsList.AddFirst (gameWeaponsList [3]);
        } else if (weaponsInInventory == 5) {
            weaponsList.AddFirst (gameWeaponsList [2]);
            weaponsList.AddFirst (gameWeaponsList [0]);
            weaponsList.AddFirst (gameWeaponsList [3]);
        } else if (weaponsInInventory == 3) {
            weaponsList.AddFirst (gameWeaponsList [1]);
            weaponsList.AddFirst (gameWeaponsList [0]);
            weaponsList.AddFirst (gameWeaponsList [3]);
        } else {
            weaponsList.AddFirst (gameWeaponsList [0]);
            weaponsList.AddFirst (gameWeaponsList [3]);
        }

        currentWeapon = weaponsList.First.Value;
        weaponsList.RemoveFirst ();
        currentWeapon.resetAudioClip ();
        currentWeapon.gameObject.SetActive (true);
        //print ("in awake now " + currentWeapon.name);

        // reset win message
        showWinMsg = false;
    }
예제 #44
0
 /// <summary>
 /// Change current weapon to different weapon.
 /// </summary>
 /// <param name="reverse">If set to <c>true</c> reverse to previous weapon</param>
 public void rotateWeapons(bool reverse)
 {
     if (!currentWeapon.am.IsPlaying (currentWeapon.shoot.name) &&
         !currentWeapon.am.IsPlaying (currentWeapon.reload.name)) {
         currentWeapon.gameObject.SetActive (false);
         if (!reverse) {
             weaponsList.AddLast (currentWeapon);
             currentWeapon = weaponsList.First.Value;
             weaponsList.RemoveFirst ();
             currentWeapon.resetAudioClip ();
             currentWeapon.gameObject.SetActive (true);
         } else {
             weaponsList.AddFirst (currentWeapon);
             currentWeapon = weaponsList.Last.Value;
             weaponsList.RemoveLast ();
             currentWeapon.resetAudioClip ();
             currentWeapon.gameObject.SetActive (true);
         }
     }
 }
예제 #45
0
    /// <summary>
    /// Acquires a weapon on ground.
    /// </summary>
    /// <param name="w">The weapon to pick up.</param>
    public void acquireWeapon(weapon w)
    {
        currentWeapon.resetShootingAnimation ();
        currentWeapon.gameObject.SetActive (false);
        weaponsList.AddLast (currentWeapon);
        currentWeapon = w;
        currentWeapon.resetAudioClip ();
        currentWeapon.gameObject.SetActive (true);
        msgTimer = 150;
        msgContent = "Picked up " + currentWeapon.name;

        if (w.name.Equals ("HK416")) {
            weaponsInInventory |= 2;
        } else if (w.name.Equals ("cz805")) {
            weaponsInInventory |= 4;
        }

        print (w.name);
    }
예제 #46
0
 public void Initialise(int[] count)
 {
     weapons = new weapon[30];
     if (count == null) {
         count = new int[weapons.Length];
     }
     int index = 0;
     #region autoClickers
     //							Weapon Type				Name						Damage		Cost		Index
     weapons[index] = new weapon(WeaponType.AutoClicker, "Drone Bomber", 			2.0f, 		50.0f, 		count[index++]);
     weapons[index] = new weapon(WeaponType.AutoClicker, "Orbital Cannon", 			16.0f, 		300.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.AutoClicker, "Solar Array",  	 		128.0f,		1500.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.AutoClicker, "Elon Star", 				2048.0f, 	900000.0f, 	count[index++]);
     #endregion
     #region playerWeapons
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "Falcon X Parts", 			1.0f, 		0.0f, 		count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "Tesla Cars", 				8.0f, 		70.0f, 		count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "PowerWall Battery Bomb", 	16.0f, 		200.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "SpaceX Rockets", 			32.0f, 		1000.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "Nuclear Bombs", 			64.0f,		5000.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "Asteroid Mining Strike", 	256.0f, 	25000.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "Space Ripper", 			512.0f, 	40000.0f, 	count[index++]);
     weapons[index] = new weapon(WeaponType.PlayerWeapon, "Black Hole Detonator", 	1024.0f, 	300000.0f, 	count[index++]);
     #endregion
 }
예제 #47
0
 public void setSelectedWeapon(string name)
 {
     foreach (weapon wep in weapons) {
         if (wep != null && wep.name == name) {
             if (selectedWeapon == wep) {
                 selectedWeapon = null;
             } else {
                 selectedWeapon = wep;
             }
         }
     }
     foreach (SelectWeaponScript button in weaponButtons) {
         if (button.weaponName == name && selectedWeapon != null) {
             button.SetSelected();
         } else {
             button.SetDeselected();
         }
     }
 }
예제 #48
0
    //load all equipment from a text file
    bool LoadEquipment(string fileName)
    {
        try
        {
            string line;

            StreamReader reader = new StreamReader(fileName, Encoding.Default);

            using (reader)
            {
                do
                {
                    line = reader.ReadLine();

                    if (line != null)
                    {
                        //skip comments
                        if(line[0] == 'c'){	continue; }
                        //split content lines
                        string[] entries = line.Split(',');
                        if(entries[0][0] == 'w'){
                            weapon temp = new weapon();
                            temp.name = entries[1];
                            temp.desc = entries[2];
                            temp.str = Int32.Parse(entries[3]);
                            temp.end = Int32.Parse(entries[4]);
                            temp.agi = Int32.Parse(entries[5]);
                            temp.mag = Int32.Parse(entries[6]);
                            temp.luck = Int32.Parse(entries[7]);
                            temp.rangeMin = Int32.Parse(entries[8]);
                            temp.rangeMax = Int32.Parse(entries[9]);
                            temp.recipe = new List<string>();
                            for(int i=10;i<entries.Length;i++){

                                temp.recipe.Add(entries[i]);
                            }
                            allWeapons.Add(temp);
                        }
                        if(entries[0][0] == 'a'){
                            armor temp = new armor();
                            temp.name = entries[1];
                            temp.desc = entries[2];
                            temp.str = Int32.Parse(entries[3]);
                            temp.end = Int32.Parse(entries[4]);
                            temp.agi = Int32.Parse(entries[5]);
                            temp.mag = Int32.Parse(entries[6]);
                            temp.luck = Int32.Parse(entries[7]);
                            temp.recipe = new List<string>();
                            for(int i=8;i<entries.Length;i++){
                                temp.recipe.Add(entries[i]);
                            }
                            allArmor.Add(temp);
                        }

                    }
                }
                while (line != null);

                reader.Close();
                //Debug.Log(allArmor.Count);
                return true;
            }
        }
        catch(IOException e){
            Debug.Log (e.Message);
            return false;
        }
    }