예제 #1
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         bees = BeeController.GetBees(Bees);
         DefineBeesSession(bees);
     }
 }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     passedTime    = 0;
     beeController = GameObject.Find("CardboardMain").GetComponent <BeeController>();
     InitPrefabs();
     InitNodes();
     StartCoroutine(SpawnBeats(4));
 }
예제 #3
0
    void OnTriggerEnter(Collider other)
    {
        BeeController beeController = other.gameObject.GetComponent <BeeController>();

        if (beeController != null)
        {
            // If object is being thrown and hasn't hit bee, hit bee
            if (!gameObject.GetComponent <InteractableItem>().isPickedUp&& !hitBee)
            {
                hitBee = true;
            }
        }
    }
예제 #4
0
        protected void LnkDamage_Click(object sender, EventArgs e)
        {
            Guid       beeId  = Guid.Parse((sender as LinkButton).CommandArgument);
            List <Bee> bees   = Bees;
            Bee        bee    = bees.Where(b => b.ID == beeId).FirstOrDefault();
            int        damage = new Random().Next(81);

            BeeController.Damage(damage, ref bee);

            DefineBeesSession(bees);

            BindBeesGrid();
        }
예제 #5
0
    /// Tell the player to shoot a bee in the direction they are facing
    private void Shoot()
    {
        if (!CanShoot())
        {
            return;
        }
        GameObject    bee           = Instantiate(beePrefab, beeShootPosition.position, Quaternion.identity);
        BeeController beeController = bee.GetComponent <BeeController>();

        beeController.Shoot(viewCamera.forward, this);
        m_ammo -= 1;
        UpdateAmmoText();
        sfxShoot.Play();
    }
    void Start()
    {
        this.cameraController = Camera.main.GetComponent <CameraController> ();

        this.spawnStuffController = GameObject.FindWithTag("GameController").
                                    GetComponent <GameSpawnStuffController>();

        this.scoreController = GameObject.FindWithTag("GameController").
                               GetComponent <GameScoreController>();
        this.beeController = GameObject.FindWithTag("bee").
                             GetComponent <BeeController>();
        this.jarController = GameObject.FindWithTag("jar").
                             GetComponent <JarController>();
        this.uiManagerController = GameObject.Find("UIManager").GetComponent <UIManagerController> ();

        audioSource = GetComponents <AudioSource>();
    }
예제 #7
0
    void Update()
    {
        // Check if we can start playing.
        if (GameplayManager.Instance.CanPlay())
        {
            // Update the spawn wait time and check if we are ready to spawn the next bee.
            spawnDelay -= Time.deltaTime;
            if (spawnDelay <= 0f)
            {
                // Get a new bee from the object pool.
                GameObject bee = ObjectPooler.Instance.GetPooledObject("Bee");
                bee.SetActive(true);

                // Randomly pick a type and position for this bee.
                int     type     = PickRandomBeeType();
                Vector3 position = PickRandomSpawnPosition();

                // Initialize the bee controller with the settings for this bee type.
                BeeController beeController = bee.GetComponent <BeeController>();
                beeController.Initialize(position, beeTypes[type].moveSpeed, beeTypes[type].material);

                // Show alert icon.
                UIManager.Instance.ShowAlertIcon(bee);

                // Increment bee count and check if we need to advance to the next spawn setting.
                beeCount++;
                if (beeCount >= spawnSettings[spawnIndex].beeCount)
                {
                    // Set to the next spawn setting and reset the bee count.
                    spawnIndex = Mathf.Min(spawnIndex + 1, spawnSettings.Length - 1);
                    beeCount   = 0;
                }

                // Reset the spawn wait time for the next bee.
                spawnDelay = Random.Range(spawnSettings[spawnIndex].minSpawnDelay, spawnSettings[spawnIndex].maxSpawnDelay);
            }
        }

        // Update buzz volume.
        UpdateBuzzVolume();
    }
예제 #8
0
    IEnumerator CreateInvaders()
    {
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 11; j++)
            {
                Vector3 birthPosition = new Vector3(-2.4f + j * 0.4f, 0.45f * i, 0);
                if (i < 2)
                {
                    GameObject    obj        = Instantiate(bee, birthPosition, Quaternion.identity) as GameObject;
                    BeeController controller = obj.GetComponent <BeeController>();
                    controller.invaderId = i * 5 + j;
                    InvaderPlatoon.Add(controller);
                }
                else if (i < 4)
                {
                    GameObject      obj        = Instantiate(squid, birthPosition, Quaternion.identity) as GameObject;
                    SquidController controller = obj.GetComponent <SquidController>();
                    controller.invaderId = i * 5 + j;
                    InvaderPlatoon.Add(controller);
                }
                else
                {
                    GameObject        obj        = Instantiate(octopus, birthPosition, Quaternion.identity) as GameObject;
                    OctopusController controller = obj.GetComponent <OctopusController>();
                    controller.invaderId = i * 5 + j;
                    InvaderPlatoon.Add(controller);
                }
                yield return(new WaitForSeconds(0.01f));
            }
        }
        movementState = MovementState.RIGHT;
        yield return(null);

        finishCreated = true;
    }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     passedTime = 0;
     beeController = GameObject.Find("CardboardMain").GetComponent<BeeController>();
     InitPrefabs();
     InitNodes();
     StartCoroutine(SpawnBeats(4));
 }
예제 #10
0
 /// <summary>
 /// Call this to set the bee this icon should be tracking.
 /// </summary>
 /// <param name="bee">Game object for the bee.</param>
 public void TrackBee(GameObject bee)
 {
     beeController = bee.GetComponent <BeeController>();
     beeTransform  = bee.transform;
 }
예제 #11
0
 void Awake()
 {
     myController = GetComponentInParent<BeeController>();
 }
예제 #12
0
    void Update()
    {
        score_text.text = "とくてん\n" + Score_have;

        // タイム
        if (standby_tl >= 0)
        {
            standby_tl           -= Time.deltaTime;
            stanbyCount_text.text = ((int)standby_tl).ToString();
            if (standby_tl <= 1)
            {
                stanbyCount_text.text = "スタート!";
            }
            if (standby_tl <= 0 && stanbyCount_text.enabled == true)
            {
                stanbyCount_text.enabled = false;
            }
        }
        else if (standby_tl <= 0)
        {
            if (Input.GetMouseButtonDown(0))
            {
                Vector3    TapPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                Collider2D col      = Physics2D.OverlapPoint(TapPoint);

                if (col)
                {
                    if (GameEnd_bool == false)
                    {
                        //GameObject obj = col.transform.gameObject;
                        // rayが当たったオブジェクトの名前を取得
                        if (col.transform.gameObject.CompareTag("Enemy"))
                        {
                            BeeController _BeeController_ = col.transform.gameObject.GetComponent <BeeController> ();
                            Score_have += _BeeController_.Score_point;
                            Debug.Log("敵を倒した!");
                            SE_point.Play();
                            GameObject inst = Instantiate(GetSpilit, col.gameObject.transform.position, Quaternion.identity);
                            _BeeController_.BeeBroken();
                            Destroy(col.transform.gameObject);
                        }
                        if (col.transform.gameObject.CompareTag("Bee"))
                        {
                            BeeController _BeeController_ = col.transform.gameObject.GetComponent <BeeController> ();
                            Score_have -= _BeeController_.Score_point % 2;
                            Debug.Log("ミツバチを誤つぶし…");
                            _BeeController_.BeeBroken();
                            Destroy(col.transform.gameObject);
                        }
                    }
                }

                if (gotoCleck_bool == true)
                {
                    gotoTitle();
                }
            }

            // デバッグキー
            if (Input.GetKeyDown("1"))
            {
                intTime_yl = 5;
            }

            if (GameEnd_bool == true)
            {
                int life_plus = life_val * 1000;
                Black_layer.SetActive(true);
                lastGetScore_text.text = "とくてん:" + (Score_have + life_plus);
                lifeBounus_text.text   = "ライフボーナス:+" + life_plus;

                // ゲームクリアorゲームオーバー
                if (GameClear_bool == true)
                {
                    GameClear.enabled = true;
                    GameOver.enabled  = false;
                }
                if (GameClear_bool == false)
                {
                    GameOver.enabled  = true;
                    GameClear.enabled = false;
                }

                // タイム
                if (gotoCan_tl >= 0)
                {
                    gotoCan_tl -= Time.deltaTime;
                }
                else
                {
                    gotoCleck_bool = true;
                }
            }
        }
    }
    bool drag           = false;        // Are we currently dragging.

    void Update()
    {
        // Check if we are currently dragging the mouse.
        if (!drag)
        {
            // We only enter drag mode during gameplay and when the player hold the left mouse button.
            if (GameplayManager.Instance.CanPlay() && Input.GetMouseButtonDown(0))
            {
                //Create 3D ray pointing into the world at the mouse position
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                //Check if our ray is hitting anything in the scene
                RaycastHit hitInfo;
                if (Physics.Raycast(ray, out hitInfo, 1000f))
                {
                    //Check if the ray hits a bee. If so, we have 'selected the bee
                    if (hitInfo.transform.CompareTag("Bee"))
                    {
                        //Make sure the bee is not stunned
                        BeeController bee = hitInfo.transform.GetComponent <BeeController>();
                        if (!bee.IsStunned())
                        {
                            //Append waypoints to path for this bee,
                            //starting at current position
                            currentPath = hitInfo.transform.GetComponentInChildren <FlightPath>();
                            currentPath.Clear();
                            currentPath.Append(hitInfo.transform.position);

                            //Enter dragmode, keep appending waypoints to bee's path
                            drag = true;
                        }
                    }
                }
            }
        }
        else
        {
            // Check if we should stay in drag mode. We will exit if the bee has reached a honeycomb
            // or the end of its path.
            if (currentPath == null || currentPath.EndReached() || currentPath.Waypoints.Count == 0)
            {
                drag = false;
            }
            else
            {
                // Create a 3D ray pointing into the world and test against the play plane, which is
                // set at position with z equals 0.
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hitInfo;
                playPlane.Raycast(ray, out hitInfo, 1000f);

                // Check if we have dragged far enough from our last waypoint.
                Vector3 currentPosition = hitInfo.point;
                Vector3 lastPosition    = currentPath.GetLastPosition();
                if (Vector3.Distance(currentPosition, lastPosition) > segmentLength)
                {
                    // Keep adding fixed-length segments up to the current position. This way the
                    // dash-line for the path will be consistent instead of looking stretched.
                    float   dragLength  = Vector3.Distance(currentPosition, lastPosition);
                    Vector3 direction   = Vector3.Normalize(currentPosition - lastPosition);
                    float   totalLength = segmentLength;
                    while (totalLength < dragLength)
                    {
                        currentPath.Append(lastPosition + (direction * totalLength));
                        totalLength += segmentLength;
                    }
                }

                // Check if the player has stopped dragging.
                if (Input.GetMouseButtonUp(0))
                {
                    // Try to snap the bee's path to the closest honeycomb.
                    Beehive.Instance.SnapToHoneycomb(currentPath);

                    // Exit drag mode.
                    drag = false;
                }
            }
        }
    }
예제 #14
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // handle camera movement
        float mouse_x = Input.GetAxis("Mouse X");
        float mouse_y = Input.GetAxis("Mouse Y");

        m_pitch = Mathf.Clamp(m_pitch - mouse_y * pitchSpeed, -85.0f, 85.0f);
        m_yaw   = Mathf.Repeat(m_yaw + mouse_x * yawSpeed, 360.0f);
        viewCamera.transform.localRotation = Quaternion.Euler(m_pitch, m_yaw, 0.0f);
        // handle WASD movement
        float   move_x   = Input.GetAxis("Horizontal");
        float   move_y   = Input.GetAxis("Vertical");
        Vector2 movement = new Vector2(move_x, move_y);

        if (movement.magnitude > 1.0f)
        {
            movement = movement.normalized;
        }
        Vector3 dir_forward = viewCamera.forward;

        dir_forward.y = 0.0f;
        dir_forward   = dir_forward.normalized;
        Vector3 dir_right = viewCamera.right;

        dir_right.y = 0.0f;
        dir_right   = dir_right.normalized;
        // change speed based on rev state
        float actualSpeed = moveSpeed;

        if (m_rev > 0.0f)
        {
            actualSpeed = revSpeedScale * moveSpeed;
        }
        Vector3 new_velocity = (dir_forward * movement.y + dir_right * movement.x) * actualSpeed;

        m_Rigidbody.velocity = new Vector3(new_velocity.x, m_Rigidbody.velocity.y, new_velocity.z);
        // handle jump
        if (m_TimeSinceJumpPressed < 0.1f)
        {
            if (CanJump())
            {
                m_Rigidbody.velocity   = new Vector3(m_Rigidbody.velocity.x, jumpSpeed, m_Rigidbody.velocity.z);
                m_TimeSinceJumpPressed = 1.0f;
            }
        }
        m_TimeSinceJumpPressed += Time.deltaTime;
        m_Rigidbody.velocity   += Vector3.down * gravityScale * Time.deltaTime;
        // handle shoot
        if (Input.GetMouseButton(0))
        {
            m_rev = Mathf.Clamp(m_rev + Time.deltaTime, 0.0f, revTime);
        }
        else
        {
            m_rev = Mathf.Clamp(m_rev - Time.deltaTime, 0.0f, revTime);
        }
        if (m_ShootBeeTimer <= 0.0f && CanShoot())
        {
            m_ShootBeeTimer = 1.0f;
            Shoot();
        }
        if (m_rev < revTime)
        {
            // Reset bee shoot timer while not fully revved.
            m_ShootBeeTimer = 1.0f;
        }
        else
        {
            // otherwise, decrement shoot timer
            m_ShootBeeTimer -= Time.deltaTime * beesPerSecond;
        }
        // rotate barrel
        barrelTransform.Rotate(Vector3.up, Time.deltaTime * revAnimationSpeed * (m_rev / revTime), Space.Self);
        // handle bee return
        if (Input.GetKey(KeyCode.Q))
        {
            GameObject[] objects = GameObject.FindGameObjectsWithTag("Bee");
            foreach (GameObject beeobject in objects)
            {
                BeeController bee = beeobject.GetComponent <BeeController>();
                bee.State = BeeController.BeeState.Returning;
            }
        }
        else if (Input.GetMouseButton(1))
        {
            Vector3      direction = viewCamera.forward;
            Vector3      position  = viewCamera.position;
            GameObject[] objects   = GameObject.FindGameObjectsWithTag("Bee");
            foreach (GameObject beeobject in objects)
            {
                BeeController bee          = beeobject.GetComponent <BeeController>();
                Vector3       beeposition  = beeobject.transform.position;
                Vector3       beedirection = (beeposition - position).normalized;
                if (Vector3.Dot(direction, beedirection) >= beeCrosshairRange)
                {
                    bee.State = BeeController.BeeState.Returning;
                }
            }
        }
        // Rev sound
        if (m_rev <= 0.0f)
        {
            sfxRev.Stop();
        }
        else if (!sfxRev.isPlaying)
        {
            sfxRev.Play();
        }
        sfxRev.pitch = 0.1f + (m_rev / revTime) * 0.6f;
    }
예제 #15
0
 void Start()
 {
     beeController = GetComponent <BeeController>();
     bee           = GetComponent <Bee>();
     soundPlayer   = GetComponent <BeeSoundPlayer>();
 }
예제 #16
0
 public BeeFSM(BeeController controller)
 {
     this.controller = controller;
     audio = ServiceLocator.getService<IAudio>();
     Reset();
 }
예제 #17
0
    // Use this for initializatio

    void Start()
    {
        beeController = GetComponent <BeeController>();
    }