Exemplo n.º 1
0
    public void setSkillwithIndex(int idx)//按索引配置技能
    {
        //gameObject.SetActive(true);
        onSkill.RemoveAllListeners();
        if (idx >= 0)
        {
            transform.localPosition = defaultPos;//移动到界面内
            switch (idx)
            {
            case 0:    //切换行走模式
                SwitchSprite ss = skillIcon.gameObject.AddComponent <SwitchSprite>();
                ss.EnabledSprite       = Resources.Load <Sprite>("Skills/Run");
                playC.ChangeMoveButton = ss;
                onSkill.AddListener(playC.ChangeMoveMode);

                break;

            case 1:
                playC.rushButton = this;
                onSkill.AddListener(playC.Rush);
                break;

            case 2:    //跳跃
                SkillDoubleCd sdcd = this.gameObject.AddComponent <SkillDoubleCd>();
                sdcd.skillIcon = skillIcon;
                //设置图标
                sdcd.buttonSprite1 = skillIcon.sprite;
                sdcd.buttonSprite2 = Resources.Load <Sprite>("Skills/Jump2");
                sdcd.CdTime1       = cdTime;
                sdcd.CdTime2       = cdTime - 1;
                sdcd.Color2        = normalColor;
                playC.jumpButton   = sdcd;
                onSkill.AddListener(playC.Jump);
                break;

            case 3:
                onSkill.AddListener(playerSkill.Skill2);
                break;

            case 4:
                playerSkill.skill3cd = this;
                onSkill.AddListener(playerSkill.playeruseskill3);
                break;

            case 5:
                onSkill.AddListener(playerSkill.GetEnergyAndLife);
                break;

            default:
                break;
            }
        }
        else //移动到界面外
        {
            transform.localPosition = new Vector2(200, 0);
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        collider2D = (BoxCollider2D)GetComponent <BoxCollider2D>();
        collider2D.transform.localScale = new Vector3(2.75f, 2.75f, 1);
        sprite    = new SwitchSprite((SpriteRenderer)GetComponent <SpriteRenderer>());
        behaviour = new MagnetSwitchBehaviour();
        hitTester = new HitTesterSwitch(collider2D.bounds);

        scaleOffset = 0.5f;
        sprite.SetToColour(SwitchPipeColour.BLUE);
    }
Exemplo n.º 3
0
 private void Start()
 {
     source = GetComponent <AudioSource>();
     if (Application.loadedLevelName == "GameScene")
     {
         newspaperSlide      = GameObject.FindGameObjectWithTag("NewspaperSlide").GetComponent <SliderScript>();
         noteSlide           = GameObject.FindGameObjectWithTag("NoteSlide").GetComponent <SliderScript>();
         photoBoy            = GameObject.FindGameObjectWithTag("PhotoBoySlide").GetComponent <SliderScript>();
         photoCerys          = GameObject.FindGameObjectWithTag("PhotoCerysSlide").GetComponent <SliderScript>();
         photoSusan          = GameObject.FindGameObjectWithTag("PhotoSusanSlide").GetComponent <SliderScript>();
         photoBoyScratched   = GameObject.FindGameObjectWithTag("PhotoBoySlide").GetComponent <SwitchSprite>();
         photoCerysScratched = GameObject.FindGameObjectWithTag("PhotoCerysSlide").GetComponent <SwitchSprite>();
         photoSusanScratched = GameObject.FindGameObjectWithTag("PhotoSusanSlide").GetComponent <SwitchSprite>();
         gameBG       = GameObject.FindGameObjectWithTag("GameBG").GetComponent <SwitchSprite>();
         boxFall      = GameObject.FindGameObjectWithTag("BoxFall").GetComponent <SwitchSprite>();
         laptop       = GameObject.FindGameObjectWithTag("LaptopStatic").GetComponent <Animator>();
         tlLight      = GameObject.FindGameObjectWithTag("TL Light");
         lpLight      = GameObject.FindGameObjectWithTag("LaptopLight");
         creepWindow  = GameObject.FindGameObjectWithTag("CreepWindow");
         creepEndGame = GameObject.FindGameObjectWithTag("CreepEndGame");
         creepEndGame.SetActive(false);
         creepWindow.SetActive(false);
         lpLight.SetActive(lpLightActive);
         if (GameManager.laptopOff)
         {
             laptop.Play("laptopOff");
         }
         if (GameManager.stage >= 6)
         {
             photoBoyScratched.NewSprite(3);
             photoCerysScratched.NewSprite(3);
             photoSusanScratched.NewSprite(3);
             gameBG.NewSprite(4);
         }
     }
     else if (Application.loadedLevelName == "InsideBox")
     {
         boxNoteSlide = GameObject.FindGameObjectWithTag("BoxNoteSlide").GetComponent <SliderScript>();
         boxAnim      = GameObject.FindGameObjectWithTag("BoxAnim").GetComponent <Animator>();
         CheckBoxAnim();
     }
     else if (Application.loadedLevelName == "InsideVent")
     {
         ventNoteSlide = GameObject.FindGameObjectWithTag("VentNoteSlide").GetComponent <SliderScript>();
         creepVent     = GameObject.FindGameObjectWithTag("CreepVent");
         creepVent.SetActive(false);
     }
 }