Example #1
0
 public JellyfishAttack(Enemy parent, AttackValueRadius tentacle, LayerMask targetLayer) : base(parent)
 {
     this.tentacle       = new AttackSet(tentacle, new CircleAreaAttack(tentacle.CD, tentacle.DetectRadius, targetLayer));
     this.tentacle.value = tentacle;
     this.targetLayer    = targetLayer;
     jf = (Jellyfish)Parent;
     jf.OnTentacleAnimFined += TentacleAnimationFin;
 }
 public JellyfishSwimState(Jellyfish jellyfish)
 {
     this.jellyfish = jellyfish;
     sprite         = EnemyFactory.Instance.CreateSwimJellyfish();
     Width          = sprite.Width;
     Height         = sprite.Height;
     Removal        = false;
 }
    // Update is called once per frame
    void FixedUpdate()
    {
        if (!basic.GlobalUI.InTutorial)
        {
            //Debug.Log("Hello jellyfish");
            if (_numJellyfish < _maxNumJellyfish)
            {
                _spawnCounter += Time.deltaTime;

                if (_spawnCounter >= _spawnCooldown)
                {
                    _numJellyfish += 1;
                    _spawnCounter  = 0;

                    Jellyfish theJellyFish = Instantiate(_jellyfishPrefab, new Vector3(Random.Range(_jellyfishZoneLeft, _jellyfishZoneRight), Random.Range(_jellyfishZoneDown, _jellyfishZoneUp), 0), gameObject.transform.rotation).GetComponent <Jellyfish>();
                    basic.AddCollectable(theJellyFish);
                }
            }
        }
    }
Example #4
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //if (!basic.GlobalUI.InTutorial)
        //{
        //Debug.Log("Hello jellyfish");
        if (_numJellyfish < _maxNumJellyfish)
        {
            _spawnCounter += Time.deltaTime;

            if (_spawnCounter >= _spawnCooldown)
            {
                _numJellyfish += 1;
                _spawnCounter  = 0;
                Vector3 spawnPos = new Vector3(Random.Range(_leftSpawner.position.x, _rightSpawner.position.x),
                                               Random.Range(_rightSpawner.position.y + _rightSpawner.lossyScale.y / 2, _rightSpawner.position.y - _rightSpawner.lossyScale.y / 2), 0);
                Jellyfish theJellyFish = Instantiate(_jellyFishPrefab, spawnPos, gameObject.transform.rotation).GetComponent <Jellyfish>();
                SpawnedJellyFish.Add(theJellyFish);
            }
        }
        //}
    }
Example #5
0
    void spawnJellyfishes()
    {
        int choicesNumber = currentQuestion.content.Length - 2;

        for (int currentJellyfish = 1; currentJellyfish <= choicesNumber; ++currentJellyfish)
        {
            GameObject newJellyfish = Instantiate(jellyfishPrefab, new Vector3(11f, -4.5f + 6f * (choicesNumber + 1 - currentJellyfish) / choicesNumber, 0), Quaternion.identity, canvas.transform);
            if (choicesNumber == 4)
            {
                RectTransform rect = newJellyfish.GetComponent <RectTransform>();
                rect.localScale = new Vector3(0.75f, 0.75f, 1.0f);
            }
            Jellyfish j = newJellyfish.GetComponent <Jellyfish>();
            j.choice = currentQuestion.content[currentJellyfish];
            if (currentJellyfish == 1)
            {
                j.triggerFishAnimIndex = "0";
            }
            else
            {
                j.triggerFishAnimIndex = choicesNumber.ToString() + "_" + (currentJellyfish - 1).ToString();
            }
        }
    }
 public NoneJellyfishState(Jellyfish pJellyfish) : base(pJellyfish)
 {
 }
Example #7
0
 private void Spawn(Jellyfish myJellies)
 {
     Jellyfish newSeed = Instantiate(myJellies, transform.position, transform.rotation) as Jellyfish;
 }
Example #8
0
 public SwimJellyfishState(Jellyfish pJellyfish, float pSpeed, float pLerpSpeed, float pRevealDuration) : base(pJellyfish)
 {
     _speed          = pSpeed;
     _lerpSpeed      = pLerpSpeed;
     _outlineCounter = new counter(pRevealDuration);
 }
 public AbstractJellyfishState(Jellyfish pJellyfish)
 {
     if (!_jellyfish) _jellyfish = pJellyfish;
 }
Example #10
0
    //
    public override void OnTriggerEnter(Collider other)
    {
        if (!_hook || !other)
        {
            return;
        }
        //Reel the hook in if you touch the floor
        if (other.gameObject.CompareTag("Floor"))
        {
            //The game time is out before this condition can be true, I am going to leave it here just in case

            /*if (basic.GlobalUI.InTutorial)
             * {
             *  basic.GlobalUI.ShowHandSwipe(false);
             *  basic.GlobalUI.SwipehandCompleted = true;
             * }*/
            SetState(hook.HookState.Reel);
            //basic.combo.ClearPreviousCombo(false);
            //GameObject.Instantiate (basic.HookHit, _hook.HookTip.position, Quaternion.identity);
        }
        //On contact with a fish
        if (other.gameObject.CompareTag("Fish"))
        {
            fish theFish = other.gameObject.GetComponent <fish>();
            if (!theFish || !theFish.Visible)
            {
                return;
            }
            theFish.SetState(fish.FishState.FollowHook);
            GameManager.ShopList.CollectFish((int)theFish.GetFishType());
            GameManager.Scorehandler.AddScore(theFish.GetFishType(), true, true);

            /*if (!basic.GlobalUI.InTutorial)
             * {
             *  basic.combo.CheckComboProgress(theFish.fishType);
             * }
             * if (!basic.Shoppinglist.Introduced)
             * {
             *  basic.Shoppinglist.Show(true);
             *  basic.Shoppinglist.Introduced = true;
             * }*/
            //basic.Camerahandler.CreateShakePoint();
        }
        if (other.gameObject.CompareTag("Jellyfish"))
        {
            Jellyfish theJellyfish = other.gameObject.GetComponent <Jellyfish>();
            if (!theJellyfish)
            {
                return;
            }
            _hook.EnableJellyAttackEffect();
            GameManager.Scorehandler.RemoveScore(true);

            // basic.Camerahandler.CreateShakePoint();

            SetState(hook.HookState.Reel);
            //basic.combo.ClearPreviousCombo(false);
            //Create a new list maybe
            //Change animation for the fish and state
            //Remove fish from list
            //Destroy fish
        }
        if (other.gameObject.CompareTag("Trash"))
        {
            trash theTrash = other.gameObject.GetComponent <trash>();
            if (!theTrash || !theTrash.Visible)
            {
                return;
            }

            theTrash.SetState(trash.TrashState.FollowHook);
            //_hook.TrashOnHook.Add(theTrash);

            //bool firstTime = basic.Scorehandler.CollectATrashPiece();
            //basic.GlobalUI.UpdateOceanProgressBar(firstTime);
            //basic.Camerahandler.CreateShakePoint();

            //The game time is out before this condition can be true, I am going to leave it here just in case

            /*if (basic.GlobalUI.InTutorial)
             * {
             *  basic.GlobalUI.ShowHandSwipe(false);
             *  basic.GlobalUI.SwipehandCompleted = true;
             * }*/
            SetState(hook.HookState.Reel);

            //basic.combo.ClearPreviousCombo(false);
        }
    }
Example #11
0
 public static void AddCollectable(Jellyfish pJellyFish)
 {
     //if (pJellyFish) ;
 }