void Awake()
 {
     _health         = GetComponent <Health>();
     _playerMovement = GetComponent <PlayerMovement>();
     _shootBullet    = GetComponent <ShootBullet>();
     _photonView     = GetComponent <PhotonView>();
 }
 public void PauseGame()
 {
     isPaused = true;
     anim.SetTrigger ("triggerOpenPauseMenu");
     mainCamera.GetComponent<Blur> ().enabled = true;
     Time.timeScale = 0f;
     //Turn off the ability to Shoot and Melee Attack
     if(player){
         if(player.GetComponentInChildren<ShootBullet>()){
             playerShootBullet = player.GetComponentInChildren<ShootBullet>();
             if(playerShootBullet.enabled){
                 playerShootBullet.enabled = false;
                 playerSBenabledBeforePause = true;
             }
             else{
                 playerSBenabledBeforePause = false;
             }
         }
         if(player.GetComponentInChildren<MeleeInfo>()){
             playerMeleeInfo = player.GetComponentInChildren<MeleeInfo>();
             if(playerMeleeInfo.enabled){
                	playerMeleeInfo.enabled = false;
                 playerMIenabledBeforePause = true;
             }
             else{
                 playerMIenabledBeforePause = false;
             }
         }
     }
 }
Beispiel #3
0
    public WeaponAnimator(GameObject weapon_part, ShootBullet fx_prefab, GameObject muzzle_target)
    {
        if (weapon_part != null)
        {
            part = weapon_part;

            if (fx_prefab != null)
            {
                fx = GameObject.Instantiate(fx_prefab).GetComponent <ShootBullet>();
                fx.transform.SetParent(muzzle_target == null ? part.transform : muzzle_target.transform);
                fx.transform.localPosition = Vector3.zero;
            }

            animator = weapon_part.GetComponent <Animator>();

            if (animator == null)
            {
                Debug.LogWarning("No Animator on Weaponpart " + weapon_part.name);
            }
        }
        else
        {
            // MDebug.Log("no weapon part");
        }
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     this.rb           = this.GetComponent <Rigidbody2D>();
     this.sb           = GetComponent <ShootBullet>();
     this.lastShotTime = Time.time; // Doing this so that when a wave loads the player doesn't double shoot
     this.ui           = uiPre.GetComponent <UIScript>();
     this.LevelSel     = GameObject.FindGameObjectWithTag("LevelSupervisor").GetComponent <LevelSupervisor>();
 }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     this.rb           = this.GetComponent <Rigidbody2D> ();
     this.sb           = GetComponent <ShootBullet> ();
     this.lastShotTime = Time.time;         // Doing this so that when a wave loads the player doesn't double shoot
     this.anim         = GetComponent <Animator>();
     this.auds         = GetComponent <AudioSource>();
 }
Beispiel #6
0
 // Start is called before the first frame update
 void Start()
 {
     detect = gameObject.GetComponent <CollisionDetection>();
     asteroidSpawningScript = asteroidSpawner.GetComponent <AsteroidSpawning>();
     shipVehicleScript      = ship.GetComponent <Vehicle>();
     shipShootBulletScript  = ship.GetComponent <ShootBullet>();
     score       = 0;
     source.clip = explosionSound;
 }
Beispiel #7
0
 void Start()
 {
     this.sb = GetComponent <ShootBullet>();
     this.rb = GetComponent <Rigidbody2D>();
     //this.sr = GetComponent<SpriteRenderer>();
     // Set center to where we currently are positioned
     this.enemyCollider  = GetComponent <PolygonCollider2D>();
     this.lk             = GetComponent <MoveLeftKinematic>();
     this.playerPosition = mainChar.GetComponent <Transform>();
     this.levSup         = GameObject.FindGameObjectWithTag("LevelSupervisor").GetComponent <LevelSupervisor>();
 }
Beispiel #8
0
    void Start()
    {
        // 放物線のLineRendererオブジェクトを用意
        CreateLineRendererObjects();

        // マーカーのオブジェクトを用意
        pointerObject = Instantiate(pointerPrefab, Vector3.zero, Quaternion.identity);
        pointerObject.SetActive(false);

        // 弾の初速度や生成座標を持つコンポーネント
        shootBullet = gameObject.GetComponent <ShootBullet>();
    }
Beispiel #9
0
    // Update is called once per frame
    void Update()
    {
        if (_shootBulCheck == true)
        {
            _shootBulCheck = false;
            shootBul       = GameObject.Find("Player(Clone)").GetComponent <ShootBullet>();

            _remainingTime -= 1 * Time.deltaTime;
            text[0].text    = ("Time:" + _remainingTime.ToString("f1"));
            text[1].text    = ("Pt:" + targetCon.TotalScore);
        }
    }
Beispiel #10
0
    IEnumerator Shoot()
    {
        canShoot = false;
        bulletShot.Play();
        ShootBullet.Spark(ShootBullet.bulletSpark);
        yield return(new WaitForSeconds(0.05f));

        sniperAnimator.Play("Bolt");
        yield return(new WaitForSeconds(1.5f));

        canShoot = true;
    }
Beispiel #11
0
    protected override void Awake()      // If you want to use awake, add stuff after base call
    {
        base.Awake();
        this.shootBullet = GetComponent <ShootBullet> ();
        this.rb          = GetComponent <Rigidbody2D> ();
        this.sr          = GetComponent <SpriteRenderer>();
        this.center      = this.transform.position;    // Set center to where we currently are positioned
        this.heldValMesh = GetComponentInChildren <TextMesh>();
        HeldCharScript hc = GetComponentInChildren <HeldCharScript>();

        if (hc != null)         // Legacy we need to just set our heldVal to the initalized val
        {
            heldVal = hc.heldValue;
        }
    }
Beispiel #12
0
 private IEnumerator Attack()
 {
     while (true)
     {
         if (_accessibleEnemies.Count > 0)
         {
             ShootBullet?.Invoke(gameObject, _accessibleEnemies[0]);
             yield return(new WaitForSeconds(_attackCooldown));
         }
         else
         {
             yield return(null);
         }
     }
 }
Beispiel #13
0
    void Start()
    {
        runner         = GameObject.Find("Runner");
        energyBar      = GameObject.Find("EnergyBar").GetComponent <Slider>();
        rightClickUses = GameObject.Find("Right Click Uses").GetComponent <Text>();

        shootBullet    = new ShootBullet(this);
        spawnDog       = new SpawnDog(this);
        spawnBarricade = new SpawnBarricade(this);
        createMine     = new CreateMine(this);

        // Right click powerup abilities
        noRightClick  = new NoRightClick(this);
        shrapnelBlast = new ShrapnelBlast(this);
        explosives    = new Explosives(this);
        stopCamera    = new StopCamera(this);
        fasterCamera  = new FasterCamera(this);

        abilityList.AddLast(createMine);
        abilityList.AddLast(spawnBarricade);
        abilityList.AddLast(explosives);
        //abilityList.AddLast(stopCamera);
        //abilityList.AddLast(fasterCamera);
        //abilityList.AddLast(shrapnelBlast);
        abilityList.AddFirst(spawnDog);

        leftClickAbility   = shootBullet;
        middleClickAbility = createMine;
        rightClickAbility  = noRightClick;

        // Grab GUI icons
        middleClickText = GameObject.Find("Middle Click Icon").GetComponent <Image>();
        rightClickText  = GameObject.Find("Right Click Icon").GetComponent <Image>();

        middleClickText.sprite = Resources.Load(middleClickAbility.iconString, typeof(Sprite)) as Sprite;
        rightClickText.sprite  = Resources.Load(rightClickAbility.iconString, typeof(Sprite)) as Sprite;
    }
 private void Start()
 {
     AmmoManager     = GameObject.FindGameObjectWithTag("Player").GetComponent <ShootBullet>();
     ammoTextManager = GameObject.FindGameObjectWithTag("Player").GetComponent <AmmoTextManager>();
 }
Beispiel #15
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.CompareTag("BlueKey"))
        {
            other.transform.SendMessage("TakeDamage", damage);
            blueKey += 1;
            if (onUpdateBlueKeys != null)
            {
                onUpdateBlueKeys(blueKey);
            }
            //if (other.gameObject.CompareName ("BlueKey")){

            //}
        }
        else if (other.gameObject.CompareTag("PinkKey"))
        {
            other.transform.SendMessage("TakeDamage", damage);
            pinkKey += 1;
            if (onUpdatePinkKeys != null)
            {
                onUpdatePinkKeys(pinkKey);
            }
        }
        else if (other.gameObject.CompareTag("BlueDoors"))
        {
            if (blueKey > 0)
            {
                other.transform.SendMessage("TakeDamage", damage);
                blueKey -= 1;
                if (onUpdateBlueKeys != null)
                {
                    onUpdateBlueKeys(blueKey);
                }
            }
        }
        else if (other.gameObject.CompareTag("PinkDoors"))
        {
            if (pinkKey > 0)
            {
                other.transform.SendMessage("TakeDamage", damage);
                pinkKey -= 1;
                if (onUpdatePinkKeys != null)
                {
                    onUpdatePinkKeys(pinkKey);
                }
            }
        }
        else if (other.gameObject.CompareTag("Room1"))
        {
            other.transform.SendMessage("Enabler", damage);
        }
        else if (other.gameObject.CompareTag("Room2"))
        {
            other.transform.SendMessage("Enabler", damage);
        }
        else if (other.gameObject.CompareTag("HealthPickup"))
        {
            other.transform.SendMessage("TakeDamage", damage);
            if (health >= 80)
            {
                health = 100;
            }
            else
            {
                health += 20;
            }
            if (onUpdateHealth != null)
            {
                onUpdateHealth(health);
            }
        }
        else if (other.gameObject.CompareTag("SpeedPickup"))
        {
            TopDownCharacterController2D otherScript = GetComponent <TopDownCharacterController2D>();
            otherScript.PowerUp();
            other.transform.SendMessage("TakeDamage", damage);
        }
        else if (other.gameObject.CompareTag("FireRatePickup"))
        {
            ShootBullet otherScript = GetComponent <ShootBullet>();
            otherScript.PowerUp();
            other.transform.SendMessage("TakeDamage", damage);
        }
    }
Beispiel #16
0
 void Start()
 {
     playerBullet = GameObject.FindGameObjectWithTag("Player").GetComponent <ShootBullet>();
 }
    private Task getBTfromGenotype(BTNode subTree)
    {
        string taskName = subTree.taskName;

        if (subTree.isLeafNode())
        {
            // Actions
            if (taskName.Equals("Jump"))
            {
                Jump temp = new Jump();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("MoveLeftForSeconds"))
            {
                MoveLeftForSeconds temp = new MoveLeftForSeconds();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("MoveRightForSeconds"))
            {
                MoveRightForSeconds temp = new MoveRightForSeconds();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("MoveRightForDistance"))
            {
                MoveRightForDistance temp = new MoveRightForDistance();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("ShootBullet"))
            {
                ShootBullet temp = new ShootBullet();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("MoveLeftForDistance"))
            {
                MoveLeftForDistance temp = new MoveLeftForDistance();
                #if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            // TO DO add conditionals
            else if (taskName.Equals("AtEdge"))
            {
                AtEdge temp = new AtEdge();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("HittingWall"))
            {
                HittingWall temp = new HittingWall();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("LowLife"))
            {
                LowLife temp = new LowLife();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else if (taskName.Equals("PlayerInRange"))
            {
                PlayerInRange temp = new PlayerInRange();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
            else
            {
                Grounded temp = new Grounded();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                return(temp);
            }
        }
        else
        {
            if (taskName.Equals("Selector"))
            {
                Selector temp = new Selector();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                List <BTNode> children = subTree.children;
                for (int i = 0; i < children.Count; i++)
                {
                    BTNode child = children[i];
                    temp.AddChild(getBTfromGenotype(child), i);
                }
                return(temp);
            }
            else if (taskName.Equals("Sequence"))
            {
                Sequence temp = new Sequence();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                List <BTNode> children = subTree.children;
                for (int i = 0; i < children.Count; i++)
                {
                    BTNode child = children[i];
                    temp.AddChild(getBTfromGenotype(child), i);
                }
                return(temp);
            }
            else if (taskName.Equals("RandomSelector"))
            {
                RandomSelector temp = new RandomSelector();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                List <BTNode> children = subTree.children;
                for (int i = 0; i < children.Count; i++)
                {
                    BTNode child = children[i];
                    temp.AddChild(getBTfromGenotype(child), i);
                }
                return(temp);
            }
            else if (taskName.Equals("RandomSequence"))
            {
                RandomSequence temp = new RandomSequence();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                List <BTNode> children = subTree.children;
                for (int i = 0; i < children.Count; i++)
                {
                    BTNode child = children[i];
                    temp.AddChild(getBTfromGenotype(child), i);
                }
                return(temp);
            }
            else
            {
                Parallel temp = new Parallel();
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
                temp.NodeData = new NodeData();
#endif
                List <BTNode> children = subTree.children;
                for (int i = 0; i < children.Count; i++)
                {
                    BTNode child = children[i];
                    temp.AddChild(getBTfromGenotype(child), i);
                }
                return(temp);
            }
        }
    }
Beispiel #18
0
 public void Start()
 {
     firerate         = 1f;
     nextFire         = Time.time;
     ShootingBehavior = new ShootBullet();
 }
Beispiel #19
0
 // Start is called before the first frame update
 void Start()
 {
     playerAmmo = GameObject.FindGameObjectWithTag("Player").GetComponent <ShootBullet>();
     UpdateText();
 }
Beispiel #20
0
 void Start()
 {
     shootBullet = GetComponent <ShootBullet>();
 }