public void StartFishing(Vector3 position, FishPool fishPool, Player player)
    {
        FishSize    newFishSize = fishPool.RandomFishSize;
        Fish        fish        = fishFactory.CreateFish(newFishSize, GetFishTemplate(newFishSize));
        PlayerStats stats       = player.GetPlayerStats();
        Inventory   inventory   = player.GetPlayerInventory();

        GameObject    fishingTargetPrefab = GameObject.Instantiate(_fishingTargetPrefab, position, Quaternion.identity);
        FishingTarget fishingTarget       = fishingTargetPrefab.GetComponent <FishingTarget>();

        if (fishingTarget != null)
        {
        }

        bool canPlayerCatchFish = CanPlayerCatchFish(fish, stats);

        Debug.Log("Start Fishing :: FishName: " + fish.Size + ", CaughtFish: " + canPlayerCatchFish);
        if (canPlayerCatchFish)
        {
            stats.AddExperience(FishingHelper.calculateFishExperience(fishPool, fish, stats));
            InventoryObject fishInventoryObject  = new InventoryObject(fish);
            bool            collectedCollectable = inventory.AddItem(fishInventoryObject);
            Debug.Log(collectedCollectable ? "Success for inventoryplacement" : "Failure for inventoryplacement");
        }
    }
Esempio n. 2
0
    private void Start()
    {
        _pool = GameObject.Find("FishPool").GetComponent <FishPool>();

        for (var i = 0; i < 3; i++)
        {
            SpawnBoids(Random.Range(8f, 20f));
        }
    }
Esempio n. 3
0
 void Start()
 {
     fishPool       = FindObjectOfType <FishPool>();
     musicPlayer    = FindObjectOfType <MusicPlayer>();
     pickupTracker  = FindObjectOfType <PickupTracker>();
     pilot          = FindObjectOfType <Pilot>();
     pilot_ID_Field = FindObjectOfType <Pilot_ID_Field>();
     player         = FindObjectOfType <Player>();
     records        = FindObjectOfType <Records>();
 }
Esempio n. 4
0
    void Init()
    {
        audioSources         = GetComponents <AudioSource>();
        thisRigidbody        = GetComponent <Rigidbody>();
        thrustParticleSystem = GetComponent <ParticleSystem>();

        fishDrones    = FindObjectsOfType <FishDrone>();
        fishPool      = FindObjectOfType <FishPool>();
        glueCam       = FindObjectOfType <GlueCam>();
        musicPlayer   = FindObjectOfType <MusicPlayer>();
        pickupTracker = FindObjectOfType <PickupTracker>();
        pilot         = FindObjectOfType <Pilot>();
        timeKeeper    = FindObjectOfType <Timekeeper>();
        uiControl     = FindObjectOfType <UIcontrol>();

        cockpit      = GameObject.FindGameObjectWithTag("Cockpit");
        thrusterBell = GameObject.FindGameObjectWithTag("Thruster_Bell");
        thrustLight  = GameObject.FindGameObjectWithTag("Thruster_Light");
        tutorialText = GameObject.FindGameObjectWithTag("Tutorial_Text");

        debugMode         = Debug.isDebugBuild;
        startPosition     = transform.position;
        startRotation     = transform.rotation;
        thrustAudioLength = thrustSound.length;
        thrustAudioTimer  = 0 - thrustAudioLength;
        thrustBubbles     = thrustParticleSystem.emission;

        thrustAudio = audioSources[0];
        xAudio      = audioSources[1];

        casualMode        = false;
        deRotating        = false;
        invulnerable      = false;
        paused            = false;
        thrustAudioTrack  = true;
        tutorialIsVisible = true;

        AdjustEmissionRate(EMISSION_RATE_INACTIVE);
        thrustPowerSlider.maxValue    = THRUST_MAX;
        thrustPowerSlider.minValue    = THRUST_MIN;
        thrustPowercapSlider.minValue = 0f;
        thrustPowercapSlider.maxValue = 1f;
        thrustPowercapSlider.value    = maxPower;
        SetPower(INITIAL_POWER_LEVEL);
        DoPowercapUpdate();

        gasLevelSlider.maxValue = FUEL_MAX;
        gasLevelSlider.minValue = 0;
        gasLevelSlider.value    = fuelLevel;
        DoGasUpdate();

        pilotNameText.text = pilot.ID;
        IndicateMode();
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
     fishIdx  = new int[fish_perfab.Count];
     //Debug.Log ("fish_perfab.Count = " + fish_perfab.Count);
     Fishes = new GameObject[fish_perfab.Count, POOL_SIZE];
     for (int i = 0; i < fishIdx.Length; i++)
     {
         fishIdx [i] = 0;
     }
     generateFishPool();
 }
Esempio n. 6
0
    public static int calculateFishExperience(FishPool pool, Fish fish, PlayerStats stats)
    {
        int experienceGained = 0;

        experienceGained += fish.ExperienceBySize;

        // TODO Limit exprience by pool modifiers
        //experienceGained -= pool.ExperiencePenaltyModifier(stats.Experience.PlayerLevel);

        if (experienceGained < 1)
        {
            experienceGained = 1;
        }

        return(experienceGained);
    }
Esempio n. 7
0
    public void Init()
    {
        if (_isInitialized)
        {
            return;
        }

        _isInitialized = true;

        body    = GetComponent <Rigidbody2D>();
        _boids  = GameObject.Find("BoidsManager").GetComponent <Boids>();
        _camera = Camera.main;
        _pool   = GameObject.Find("FishPool").GetComponent <FishPool>();

        _curFrame = Random.Range(0, 100);
    }
Esempio n. 8
0
    //TODO - awfull
    private void _onRightButtonClick(GameObject clickedGO, Vector3 point)
    {
        GameObject    player        = GameObject.FindGameObjectWithTag("PlayerSelf");
        FishPool      fishPool      = clickedGO.GetComponent <FishPool>();
        FishingTarget fishingTarget = clickedGO.GetComponent <FishingTarget>();

        if (FishingHelper.canStartFishing(fishingController.throwDistance, player.transform.position, point, clickedGO) && fishPool)
        {
            // TODO - Fix This
            fishingController.StartFishing(point, fishPool, player.GetComponent <Player>());
        }
        else if (fishingTarget != null)
        {
            fishingTarget.TriggerFishOn();
        }
        else if (UnitSelection.IsSelected(player))
        {
            player.GetComponent <Player>().MoveTo(point);
        }
    }