Пример #1
0
 void Start()
 {
     nextFire          = Time.time;
     spiderRigidbody2D = GetComponent <Rigidbody2D>();
     spiderAnimator    = GetComponent <Animator>();
     spiderController  = GetComponent <SpiderController>();
 }
    private void CheckDistance(GameObject obj, float dist, bool controllerType)
    {
        if (Vector3.Distance(transform.position, obj.transform.position) <= dist && controllerType)
        {
            HeroController hCtrl = obj.GetComponent <HeroController>();
            if (CardColor.Equals("red"))
            {
                hCtrl.HasRedKeyCard = true;
            }
            if (CardColor.Equals("blue"))
            {
                hCtrl.HasBlueKeyCard = true;
            }
            hCtrl.PlayKeyCardAudio();
            Destroy(this.gameObject);
        }

        if (Vector3.Distance(transform.position, obj.transform.position) <= dist && !controllerType &&
            !spider.GetComponent <SpiderController>().destroyFlag)
        {
            SpiderController sCtrl = obj.GetComponent <SpiderController>();
            if (CardColor.Equals("red"))
            {
                sCtrl.HasRedKeyCard = true;
            }
            if (CardColor.Equals("blue"))
            {
                sCtrl.HasBlueKeyCard = true;
            }
            sCtrl.PlayKeyCardAudio();
            Destroy(this.gameObject);
        }
    }
Пример #3
0
    void Awake()
    {
        GameObject eventManagerObj = GameObject.Find("EventManager");

        if (!eventManagerObj)
        {
            Debug.LogError("Scene must contain EventManager and corresponding script");
        }
        _eventManager = eventManagerObj.GetComponent <EventManager> ();
        if (!_eventManager)
        {
            Debug.LogError("EventManager has no attached script");
        }
        GameObject spider = GameObject.Find("Spider");

        if (!spider)
        {
            Debug.LogError("Scene must contain Spider and corresponding script");
        }
        _spiderController = spider.GetComponent <SpiderController>();
        if (!_spiderController)
        {
            Debug.LogError("Spider has no attached script");
        }
    }
Пример #4
0
    void Start()
    {
        SpiderController sc = enemy.GetComponent <SpiderController>();

        sc.gameArea = this.gameArea;
        InvokeRepeating("Spawn", spawnTime, spawnTime);
    }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     firstSpider  = SpiderPositioner.spiders [0].GetComponent <SpiderController>();
     secondSpider = SpiderPositioner.spiders [1].GetComponent <SpiderController>();
     thridSpider  = SpiderPositioner.spiders [2].GetComponent <SpiderController>();
     fourthSpider = SpiderPositioner.spiders [3].GetComponent <SpiderController>();
     fifthSpider  = SpiderPositioner.spiders [4].GetComponent <SpiderController>();
 }
Пример #6
0
    /// <summary>
    /// Attaches a leg to a target
    /// </summary>
    public void Attach()
    {
        SpiderController s = spiderCore.GetComponent <SpiderController>();

        if (legStepper.TryAttach(thigh, target, spiderCore, spiderLegTarget))
        {
            isEnabled = false;
        }
    }
 void Start()
 {
     throwStart         = GameObject.FindGameObjectWithTag("ThrowStart");
     start_pos          = throwStart.transform.position;
     transform.position = start_pos;
     spider             = GameObject.Find("SpiderObject");
     spider_pos         = spider.transform.position;
     spidercontrols     = spider.GetComponent <SpiderController>();
     emitter            = GetComponent <SoundTrigger>();
 }
Пример #8
0
        public static void TestBridgeDesign()
        {
            HumanoidController humanoidController = new HumanoidController(new Humanoidchar());

            humanoidController.RunChar();

            SpiderController spiderController = new SpiderController(new SpiderChar());

            spiderController.RunChar();
        }
Пример #9
0
 // Use this for initialization
 void Start()
 {
     elapsedTurnsBar_Script = GameObject.Find("Turn_Bar_Elapsed").GetComponent <TurnBarVisuals>();
     for (int i = 0; i < Turns_Total; i++)
     {
         m_eventList[i] = EventType.Null;
     }
     m_eventList[Turns_Total] = EventType.GameOver;  //Example
     //m_eventList[3] = EventType.GoodEvent;
     //m_eventList[5] = EventType.BadEvent;
     spider_Script        = GameObject.Find("SpiderObject").GetComponent <SpiderController>();
     sceneLoaderBehaviour = GameObject.Find("SceneLoader").GetComponent <SceneLoaderBehaviour>();
     emitter = GetComponent <SoundTrigger>();
 }
Пример #10
0
    // Start is called before the first frame update
    void Start()
    {
        //goalflag = false;
        Player          = GameObject.Find("MotionPlayer");
        playerconroller = Player.GetComponent <PlayerController>();

        if (Spider)
        {
            spidercontroller = Spider.GetComponent <SpiderController>();
        }

        mousemanager = GameObject.Find("MouseManager");
        lockcursor   = mousemanager.GetComponent <LockCursor>();
    }
Пример #11
0
    IEnumerator Attach(Transform startTarget, Transform endTarget, GameObject spiderCore, Transform spiderLegTarget)
    {
        // Indicate we're moving
        Moving = true;

        // Store the initial conditions
        Quaternion startRot   = startTarget.rotation;
        Vector3    startPoint = startTarget.position;
        Quaternion endRot     = endTarget.rotation;
        Vector3    endPoint   = endTarget.position;

        // We want to pass through the center point
        Vector3 centerPoint = startPoint;

        // But also lift off, so we move it up by half the distance
        //centerPoint += startTarget.up * Vector3.Distance(startPoint, endPoint) / 2f;
        centerPoint += startTarget.forward * Vector3.Distance(startPoint, endPoint) / 2f;
        centerPoint += startTarget.right * Vector3.Distance(startPoint, endPoint) / 2f;

        float timeElapsed = 0;

        do
        {
            timeElapsed += Time.deltaTime;
            float normalizedTime = timeElapsed / attachMoveDuration;
            normalizedTime = Easing.Cubic.InOut(normalizedTime);

            //Quadratic bezier curve
            startTarget.position = Vector3.Lerp(
                Vector3.Lerp(startPoint, centerPoint, normalizedTime),
                Vector3.Lerp(centerPoint, endPoint, normalizedTime),
                normalizedTime);
            startTarget.rotation = Quaternion.Slerp(startRot, endRot, normalizedTime);

            yield return(null);
        } while (timeElapsed < attachMoveDuration);

        // Done moving
        Moving = false;

        // Start a second coroutine to get the leg firmly in place.
        SpiderController s = spiderCore.GetComponent <SpiderController>();

        StartCoroutine(Attach2(spiderLegTarget));
        s.isEnabled++;
    }
Пример #12
0
    private void Update()
    {
        if (!disableUpdate)
        {
            SpiderController s = spiderCore.GetComponent <SpiderController>();

            if ((s.isEnabled == 4) && !legStepper.Moving && s.enabled == false)
            {
                s.enabled = true;
                s.startCo();
                disableUpdate = true;
                this.enabled  = false;
            }
            else if ((s.isEnabled == 4) && !legStepper.Moving)
            {
                disableUpdate = true;
                this.enabled  = false;
            }
        }
    }
Пример #13
0
    /*
     * IEnumerator RandomLegAdjustment()
     * {
     *  while (StandingStill)
     *  {
     *      float timer = Random.Range(1f, 2f);
     *
     *      yield return new WaitForSeconds(timer);
     *
     *      int randomLeg = Random.Range(0, 7);
     *      //Debug.Log(randomLeg);
     *
     *      RaycastHit hit;
     *      if (Physics.Raycast(raycasters[randomLeg].position, -raycasters[randomLeg].up, out hit))
     *      {
     *          if (!moving[randomLeg])
     *          {
     *              if (canLegMove(randomLeg))
     *                  StartCoroutine(MoveLeg(targets[randomLeg], targets[randomLeg].position, hit.point + legFix, randomLeg));
     *          }
     *      }
     *
     *  }
     * }
     */

    void Start()
    {
        controller = FindObjectOfType <SpiderController>().GetComponent <SpiderController>();


        // Get each legFabric from legs
        legFabrics = new IKFabric[legs.Length];
        for (int i = 0; i < legFabrics.Length; i++)
        {
            legFabrics[i] = legs[i].GetComponentInChildren <IKFabric>();
            //Debug.Log(legFabrics[i]);
        }


        // Get targets from each legFabric
        targets = new Transform[legs.Length];
        for (int i = 0; i < legs.Length; i++)
        {
            targets[i] = legFabrics[i].Target;
        }

        moving = new bool[targets.Length];



        int[] list0 = new int[4] {
            0, 3, 4, 7
        };
        int[] list1 = new int[4] {
            1, 2, 5, 6
        };

        movingPairs = new int[][] { list0, list1 };

        //StartCoroutine(RandomLegAdjustment());
        //CreateSoundSystem();
    }
Пример #14
0
        private async void pictureBoxFind_Click(object sender, EventArgs e)
        {
            pictureBoxFind.Enabled = false;//防止多次点击

            string bookName = uiTextBoxName.Text;

            _spiderController = new SpiderController(bookName);
            if (bookName == "")
            {
                MessageBox.Show("Please input book name before searching", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            _bookHtmlContents = new List <List <SpiderController.BookHtmlContent> > {
                (List <SpiderController.BookHtmlContent>) await _spiderController.ReadNextAsync()
            };
            int bookNo = 1;

            foreach (var item in _bookHtmlContents[_pageCount++])
            {
                uiDataGridViewBookInfo.AddRow(bookNo++.ToString(), item.Title, item.Rate, item.Subjects);
            }

            pictureBoxFind.Enabled = true;                      // 恢复再次查询按钮
            pictureBoxNext.Enabled = _spiderController.HasNext; // 可以点击下一页如果有下一页
        }
Пример #15
0
        private async void uiDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)  //选择函数
        {
            int number = int.Parse(uiDataGridViewBookInfo.SelectedRows[0].Cells[0].Value.ToString());

            textBoxTitle.Text    = "《" + _bookHtmlContents[_pageCurrentNo][number - 1].Title + "》";//由于是从1开始所以要减1
            linkLabelUrl.Text    = _bookHtmlContents[_pageCurrentNo][number - 1].Url;
            textBoxSubjects.Text = _bookHtmlContents[_pageCurrentNo][number - 1].Subjects;
            textBoxRate.Text     = _bookHtmlContents[_pageCurrentNo][number - 1].Rate;
            textBoxDetail.Text   = _bookHtmlContents[_pageCurrentNo][number - 1].Detail;
            starClear();
            if (textBoxRate.Text != "")
            {
                getStar(double.Parse(textBoxRate.Text));
            }
            // 添加图片
            string imageUrl = _bookHtmlContents[_pageCurrentNo][number - 1].ImageUrl;

            if (imageUrl == "")
            {
                return;
            }
            Stream image = await SpiderController.GetImageStreamAsync(imageUrl);

#pragma warning disable IDE0059
            Image img = null;
#pragma warning restore IDE0059
            try {
                img = Image.FromStream(image);
            }
            catch (ArgumentException) {
                // 加载图片失败,不处理
                return;
            }
            //Bitmap bmp = ScaleImage(img, pictureBoxBook.Width, pictureBoxBook.Height);
            pictureBoxBook.Image = img.ScaleImage(pictureBoxBook.Width, pictureBoxBook.Height);
        }
Пример #16
0
    private void Awake()
    {
        LoadPrefs();

        Resources.UnloadUnusedAssets();
        prev_width  = Screen.width;
        prev_height = Screen.height;

        Restart_Button.onClick.AddListener(/*Restart*/ StartRestart);
        Options_Button.onClick.AddListener(Options);
        Menu_Button.onClick.AddListener(ReturnToMenu);
        Fullscreen_Button.onClick.AddListener(ToggleFullscreen);
        Particles_Button.onClick.AddListener(ToggleParticles);
        Effects_Button.onClick.AddListener(TogglePostProcessing);

        Res1440_Button.onClick.AddListener(() => { SetResolution(1440); });
        Res1080_Button.onClick.AddListener(() => { SetResolution(1080); });
        Res720_Button.onClick.AddListener(() => { SetResolution(720); });

        setButtonOn(Fullscreen_Button, Screen.fullScreen);
        Fullscreen_Button.GetComponentInChildren <Text>().text = "FULLSCREEN: " + (Screen.fullScreen ? "ON" : "OFF");

        setButtonOn(Particles_Button, PlayerPrefs.GetInt("screen_particles") == 1 ? true : false);
        Particles_Button.GetComponentInChildren <Text>().text = "SCREEN PARTICLES: " + (PlayerPrefs.GetInt("screen_particles") == 1 ? "ON" : "OFF");

        setButtonOn(Effects_Button, postfxon);
        Effects_Button.GetComponentInChildren <Text>().text = "POST PROCESSING: " + (postfxon ? "ON" : "OFF");

        MusicSlider.value = music_volume;
        SfxSlider.value   = sfx_volume;

        Saving.text = "";

        LoadData();

        int i = 0;

        for (int j = 0; j < coin_count.Length; j++)
        {
            CoinIcons[j].GetComponent <Image>().color = new Color(1, 1, 1, coin_count[j] == 1 ? 1 : 0);

            Coins[i].gameObject.SetActive(coin_count[j] == 0);
            Coins[i + 1].gameObject.SetActive(coin_count[j] == 1);
            i += 2;
        }

        player      = GameObject.Find("Player");
        playerlight = GameObject.Find("Player Light Bright"); playerlight.SetActive(false);
        effects     = GameObject.Find("EFFECTS");
        globallight = GameObject.Find("Global Light");

        cubecontroller = player.GetComponent <CubeController>();
        autocontroller = player.GetComponent <AutoController>();

        shipcontroller     = player.GetComponent <ShipController>();
        autoshipcontroller = player.GetComponent <AutoShipController>();

        ufocontroller     = player.GetComponent <UfoController>();
        autoufocontroller = player.GetComponent <AutoUfoController>();

        wavecontroller     = player.GetComponent <WaveController>();
        autowavecontroller = player.GetComponent <AutoWaveController>();

        ballcontroller     = player.GetComponent <BallController>();
        autoballcontroller = player.GetComponent <AutoBallController>();

        spidercontroller     = player.GetComponent <SpiderController>();
        autospidercontroller = player.GetComponent <AutoSpiderController>();

        coptercontroller     = player.GetComponent <CopterController>();
        autocoptercontroller = player.GetComponent <AutoCopterController>();

        //------------------------------------------------------------------------------------------------
        playercontroller     = cubecontroller;
        checkpointcontroller = FindObjectOfType <Checkpoint_Controller>();

        playercontroller.setBGMusic(bgmusic.audio);
        newbgmusic = bgmusic;

        iconcontroller = FindObjectOfType <IconController>();
        icon           = iconcontroller.getIcon();

        playercontroller.setIcons(icon);

        // ------------------------------------------------------------------------------------------------

        /*channel_colors = new Color[color_channels.Length];
         * int i = 0;
         * foreach(ColorReference c in color_channels)
         * {
         *  channel_colors[i] = c.channelcolor;
         *  if(c.refer != null) { channel_colors[i] = c.refer.channelcolor; }
         *  i++;
         * }*/

        // camera list ------------------------
        cameraList  = new List <CinemachineVirtualCamera>();
        initialList = GameObject.FindGameObjectsWithTag("Camera");

        i = 0;
        foreach (GameObject g in initialList)
        {
            cameraList.Add(g.GetComponent <CinemachineVirtualCamera>());
            cameraList[i].gameObject.SetActive(true);
            cameraList[i].Priority = 5;
        }

        /*if (postfxon && main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>() != null)
         * {
         *  main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>().enabled = true;
         *  effects.SetActive(true);
         * }
         * else
         * {
         *  main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>().enabled = false;
         *  effects.SetActive(false);
         * }*/
    }
Пример #17
0
 public void Setup()
 {
     spider = new SpiderController("高等数学");
 }
Пример #18
0
 // Use this for initialization
 void Start()
 {
     playerRB  = transform.parent.GetComponent <Rigidbody2D>();
     spidercon = FindObjectOfType <SpiderController>();
 }
Пример #19
0
 void Awake()
 {
     enabled = false;
     _controller = GetComponent<SpiderController>();
 }
Пример #20
0
    public void interaccioPlataforma(Plataforma ground)
    {
        if (player.MoveToPoint(ground))
        {
            playSound(5);
            LizardController[] lizards = (LizardController[])GameObject.FindObjectsOfType(typeof(LizardController));
            foreach (LizardController lizard in lizards)
            {
                if (lizard != null)
                {
                    lizard.Move(ground);
                }
            }

            SpiderController[] spiders = (SpiderController[])GameObject.FindObjectsOfType(typeof(SpiderController));
            foreach (SpiderController spider in spiders)
            {
                if (spider != null)
                {
                    spider.Move();
                }
            }

            if (player.hasGun)
            {
                calculaShooteables();
            }
        }
        else if (player.hasGun)
        {
            if (ground.entity != null)
            {
                if (ground.entity.tag == "Snake")
                {
                    SnakeController snake = ground.entity.GetComponent <SnakeController>();
                    if (snake.shooteable)
                    {
                        player.shoot(ground);
                        //Instantiate(newObject, transform.position, transform.rotation);
                    }
                }
                else if (ground.entity.tag == "Lizard")
                {
                    LizardController lizard = ground.entity.GetComponent <LizardController>();
                    if (lizard.shooteable)
                    {
                        player.shoot(ground);
                        //Instantiate(newObject, GameObject.FindGameObjectWithTag("Player").transform.position + new Vector3(0,2f,0), GameObject.FindGameObjectWithTag("Player").transform.rotation * Quaternion.Euler(euler: new Vector3(0, -90, 0)));
                    }
                }
                else if (ground.entity.tag == "Spider")
                {
                    SpiderController spider = ground.entity.GetComponent <SpiderController>();
                    if (spider.shooteable)
                    {
                        player.shoot(ground);
                        //Instantiate(newObject, GameObject.FindGameObjectWithTag("Player").transform.position + new Vector3(0,2f,0), GameObject.FindGameObjectWithTag("Player").transform.rotation * Quaternion.Euler(euler: new Vector3(0, -90, 0)));
                    }
                }
                //ground.entity.die()
            }
        }
    }
Пример #21
0
    private void Start()
    {
        SpiderController s = spiderCore.GetComponent <SpiderController>();

        s.enabled = false;
    }
    // Update is called once per frame
    void Update()
    {
        hero = GameObject.Find("Hero(Clone)");
        if (hero != null)
        {
            HeroController hCtrl = hero.GetComponent <HeroController> ();

            if (hCtrl.EnableMovement)
            {
                if (CardColor.Equals("red"))
                {
                    if (hCtrl.HasRedKeyCard)
                    {
                        cr.SetAlpha(1.0f);
                    }
                    else
                    {
                        cr.SetAlpha(0);
                    }
                }
                if (CardColor.Equals("blue"))
                {
                    if (hCtrl.HasBlueKeyCard)
                    {
                        cr.SetAlpha(1.0f);
                    }
                    else
                    {
                        cr.SetAlpha(0);
                    }
                }
            }
            else
            {
                spider = GameObject.FindGameObjectWithTag("Spider");
                if (spider)
                {
                    SpiderController sCtrl = spider.GetComponent <SpiderController> ();

                    if (CardColor.Equals("red"))
                    {
                        if (sCtrl.HasRedKeyCard)
                        {
                            cr.SetAlpha(1.0f);
                        }
                        else
                        {
                            cr.SetAlpha(0);
                        }
                    }
                    if (CardColor.Equals("blue"))
                    {
                        if (sCtrl.HasBlueKeyCard)
                        {
                            cr.SetAlpha(1.0f);
                        }
                        else
                        {
                            cr.SetAlpha(0);
                        }
                    }
                }
            }
        }
    }
Пример #23
0
 void Awake()
 {
     enabled     = false;
     _controller = GetComponent <SpiderController>();
 }