コード例 #1
0
ファイル: CopsZone.cs プロジェクト: GrenadeJane/KYT-2018
    /// <summary>
    /// Get the amount of alcool in the swarm + stop them to move
    /// </summary>
    void ProceedToCheck(SwarmObject swarmObject) // param current swarm
    {
        SwarmObjectCop cop = swarmObject as SwarmObjectCop;

        cop.EndAlert();
        if (cop.SwarmTarget.ComposedOfAMaya)
        {
            cop.GoesToUniqueTarget = false;
            cop.SwarmTarget.EndChecked();
        }
        else
        {
            CoroutineUtils.ExecuteWhenFinished(this, new WaitForSeconds(timeCheck), () =>
            {
                cop.GoesToUniqueTarget = false;

                float alcoholAmount = cop.SwarmTarget.TotalSwarmPollenAmount;

                if (alcoholAmount >= (FestBeeSwarm.DRUNK_POLLEN_AMOUNT))
                {
                    cop.SwarmTarget.FailedPolitest();
                }
                else
                {
                    cop.SwarmTarget.SuccessPolitest();
                }

                // send back to home if needed
                if (_countPoliTest <= 0 && state != CopState.GoToHive)
                {
                    GoToHive();
                }
            });
        }
    }
コード例 #2
0
ファイル: CopsZone.cs プロジェクト: GrenadeJane/KYT-2018
    /// <summary>
    ///
    /// </summary>
    /// <param name="swarm"></param>
    /// <param name="targetPos"></param>
    void SendCopToPlace(FestBeeSwarm swarm, Vector3 targetPos, Vector3 dir)
    {
        SwarmObjectCop cop = currentSwarm.GetRandomnlyObject();

        if (cop != null)
        {
            swarm.IsChecked();
            cop.Alert();

            cop.AssignNewTarget(targetPos, dir);
            cop.SwarmTarget = swarm;

            cop.OnTargetReached  = null;
            cop.OnTargetReached += ProceedToCheck;
        }
    }
コード例 #3
0
ファイル: CopsZone.cs プロジェクト: GrenadeJane/KYT-2018
    void GenerateCopSwarm()
    {
        Transform swarmExit = HiveMain.m_Instance.gameObject.transform;

        currentSwarm = Instantiate(copSwarmPrefab, swarmExit.position, Quaternion.identity);
        currentSwarm.m_SwarmRadius = startRange;

        for (int i = 0; i < baseCountCops; i++)
        {
            SwarmObjectCop cop = Instantiate(copPrefab, currentSwarm.transform, false);
            cop.transform.position = swarmExit.position;

            currentSwarm.AddSwarmObject(cop);
        }

        currentSwarm.TargetPosition = HiveMain.m_Instance.gameObject.transform.position;
    }