Example #1
0
 public void GetOn()
 {
     transform.position = new Vector3(6.45f, 0.05f, 0.05f);
     transform.parent   = MyObject.Find("PropSet/Taxi").transform;
     GetComponent <PlayerController>().enabled = false;
     GetComponent <Animator>().enabled         = false;
     GetComponent <PlayerStatus>().isInCarrier = true;
 }
Example #2
0
 void DiscardPuppy()
 {
     MyObject.SetObjectActive("Canvas/Aside");
     MyObject.Find("NPC/Puppy").transform.position = new Vector3(189.0f, -0.45f, -0.2f);
     MyObject.Find("NPC/Puppy").GetComponent <PlayerController>().ClearTarget();
     MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().SetTarget("NPC/Puppy");
     MyObject.SetObjectActive("NPC/Stranger");
 }
Example #3
0
 //
 void GetBack()
 {
     MyObject.SetObjectActive("Canvas/Aside");
     MyObject.SetObjectActive("NPC/Huskie");
     MyPlayer.SetPlayer("NPC/Huskie");
     MyObject.Find("NPC/Huskie").transform.position = new Vector3(21.0f, -0.2f, -0.2f);
     MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().transform.position = new Vector3(22.0f, 2, -10);
     MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().SetTarget(MyPlayer.GetPlayer());
     MyObject.Find("NPC/Huskie").GetComponent <PlayerController>().enabled = true;
     MyObject.Find("NPC/Huskie").GetComponent <PlayerController>().SetDirection(-1);
 }
Example #4
0
 private void OnMouseDown()
 {
     if (Dialogue.nowIndex >= 7)
     {
         MyObject.Find("AudioSet/SwitchLight").GetComponent <AudioSource>().Play();
         nowIndex = (nowIndex + 1) % 2;
         GetComponent <SpriteRenderer>().sprite = switchs[nowIndex];
         transform.GetChild(0).transform.GetChild(0).gameObject.SetActive(nowIndex == 1 ? true : false);
         if (Dialogue.nowIndex == 7)
         {
             GameObject.Find("Canvas").transform.GetChild(3).gameObject.SetActive(true);
         }
     }
 }
Example #5
0
 void Awaken()
 {
     MyObject.SetObjectActive("Canvas/Aside");
     MyPlayer.ResetPlayer();
     MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().SetTarget(MyPlayer.GetPlayer());
     MyObject.Find("Camera").transform.position = new Vector3(220, 2, -10);
     MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().FixScreen();
     MyObject.Find("NPC/Huskie").transform.position = new Vector3(39.5f, -0.3f, -0.2f);
     MyObject.Find("NPC/Huskie").GetComponent <PlayerStatus>().WakeUp();
     MyObject.Find("NPC/Huskie").GetComponent <PlayerController>().enabled = false;
     MyObject.Find("NPC/Huskie").GetComponent <Animator>().SetInteger("Status", 0);
     MyObject.Find("NPC/Huskie").transform.localScale = new Vector3(0.5f, 0.5f, 1.0f);
     gameObject.SetActive(false);
     Invoke("ActiveDialogue", 3.0f);
 }
 public static void Alternate()
 {
     isDay = !isDay;
     GameObject.Find("Camera/Background").GetComponent <ChangeBackground>().Change();
     MyObject.SetObjectActive("Camera/Sun", isDay);
     GameObject.Find("SunLight").GetComponent <Light>().intensity = isDay ? 1.0f : 0.0f;
     if (isDay)
     {
         MyObject.Find("Canvas/Dialogue").GetComponent <Text>().color = new Color32(0, 0, 0, 255);
     }
     else
     {
         MyObject.Find("Canvas/Dialogue").GetComponent <Text>().color = new Color32(255, 255, 255, 255);
     }
 }
Example #7
0
 //逃跑
 void Flee()
 {
     if (transform.position.x < 237.25)
     {
         myAnimator.SetInteger("Status", 1);
         walkDirection = 1;
     }
     else
     {
         actionStatus = -1;
         MyObject.Find("GirlHome/FatherBed").GetComponent <FurnitureBehaviour>().ChangeSprite(0);
         MyObject.SetObjectActive("NPC/Father");
         Invoke("AlarmFather", 3.0f);
         MyObject.SetObjectActive("Canvas/Dialogue");
         gameObject.SetActive(false);
     }
     transform.Translate(walkDirection * walkSpeed * Time.deltaTime, 0, 0);
 }
Example #8
0
 void Brake()
 {
     if (audioStatus < 2)
     {
         GameObject.Find("AudioSet/BrakeCar").GetComponent <AudioSource>().Play();
         GameObject.Find("AudioSet/MoveCar").GetComponent <AudioSource>().Stop();
         audioStatus = 2;
     }
     if (nowSpeed != 0.0f)
     {
         nowSpeed += deceleratedSpeed * Time.deltaTime;
         transform.Translate(direction * nowSpeed * Time.deltaTime, 0, 0);
     }
     if (nowSpeed <= 0.2f)
     {
         nowSpeed = 0.0f;
         nowTime += Time.deltaTime;
         //激活对话框
         if (canActiveDialogue)
         {
             MyObject.SetObjectActive("Canvas/Dialogue");
             canActiveDialogue = false;
         }
         if (nowTime - launchTime >= 2.5f)
         {
             //下车
             MyObject.Find("YangYi").GetComponent <TakeCar>().GetOff();
             //恢复摄像机平滑系数
             HorizontalSmoothFollow.smoothing = 2.0f;
             if (direction == 1)
             {
                 direction = -1;
             }
             else
             {
                 MyObject.SetObjectActive("Canvas/Dialogue");
             }
             nowTime = 0.0f;
             enabled = false;
         }
     }
 }
Example #9
0
 //下楼
 void GoDownstairs()
 {
     if (transform.position.y == 2.15f)
     {
         if (transform.position.x < 239.75f)
         {
             walkDirection = 1;
             myAnimator.SetInteger("Status", 1);
         }
         else if (nowTime <= 2.0f)
         {
             nowTime += Time.deltaTime;
             GetComponent <SpriteRenderer>().enabled = false;
         }
         else
         {
             nowTime = 0.0f;
             GetComponent <SpriteRenderer>().enabled = true;
             transform.position = new Vector3(239.75f, -0.1f, -0.2f);
         }
         transform.Translate(walkDirection * walkSpeed * Time.deltaTime, 0, 0);
     }
     else if (transform.position.y == -0.1f)
     {
         if (transform.position.x > 236.4f)
         {
             walkDirection = -1;
         }
         else
         {
             myAnimator.SetInteger("Status", 0);
             MyObject.SetObjectActive("Canvas/Dialogue");
             Invoke("DiscardPuppy", 2.0f);
             MyObject.Find("AudioSet/BGM").GetComponent <BGMManager>().PlayBGM("GuDeng");
             actionStatus = -1;
         }
         transform.Translate(walkDirection * walkSpeed * Time.deltaTime, 0, 0);
     }
 }
Example #10
0
 //去睡觉
 void MoveToSleep()
 {
     if (transform.position.y == -0.1f)
     {
         if (transform.position.x < 239.75f)
         {
             walkDirection = 1;
             myAnimator.SetInteger("Status", 1);
         }
         else if (nowTime <= 2.0f)
         {
             nowTime += Time.deltaTime;
             GetComponent <SpriteRenderer>().enabled = false;
         }
         else
         {
             nowTime = 0.0f;
             GetComponent <SpriteRenderer>().enabled = true;
             transform.position = new Vector3(239.75f, 2.15f, -0.2f);
         }
         transform.Translate(walkDirection * walkSpeed * Time.deltaTime, 0, 0);
     }
     else if (transform.position.y == 2.15f)
     {
         if (transform.position.x > 238.2f)
         {
             walkDirection = -1;
         }
         else
         {
             myAnimator.SetInteger("Status", 0);
             walkDirection = 1;
             actionStatus  = -1;
             gameObject.SetActive(false);
             MyObject.Find("GirlHome/FatherBed").GetComponent <FurnitureBehaviour>().ChangeSprite(1);
         }
         transform.Translate(walkDirection * walkSpeed * Time.deltaTime, 0, 0);
     }
 }
Example #11
0
    //解救小狗
    void RescueDog()
    {
        GameObject _Faint = MyObject.Find("StoryTriggerSet/Faint");

        if (transform.position.x - _Faint.transform.position.x >= 0.2f)
        {
            myAnimator.SetInteger("Status", 1);
            transform.Translate(walkDirection * walkSpeed * Time.deltaTime, 0, 0);
        }
        else
        {
            myAnimator.SetInteger("Status", 0);
            AppearInRoom();
            MyObject.Find("NPC/Puppy").transform.position = new Vector3(235.7f, 1.86f, -0.2f);
            MyObject.Find("NPC/Puppy").GetComponent <PlayerStatus>().WakeUp();
            MyObject.Find("NPC/Puppy").transform.localScale = new Vector3(-0.6f, 0.6f, 1);
            MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().FixScreen(new Vector3(235.6f, 2, -10));
            MyObject.SetObjectActive("Canvas/Aside");
            MyObject.Find("AudioSet/BGM").GetComponent <BGMManager>().PlayBGM("GirlHome");
            actionStatus = -1;
        }
    }
Example #12
0
    void Activate()           //激活触发器
    {
        GameObject target = MyPlayer.GetPlayer();

        if (MySpace.IsInArea2D(target, gameObject, 0.4f))
        {
            gameObject.SetActive(false);
            switch (eventName)
            {
            case "DriveDog":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");          //激活对话框
                break;
            }

            case "NightFall":
            {
                MyObject.SetObjectActive("Canvas/Aside");
                MyObject.SetObjectActive("PropSet/Taxi");
                MyObject.SetObjectActive("NPC/Huskie", false);
                WeatherManager.Alternate();
                break;
            }

            case "TakeCar":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");          //激活对话框
                break;
            }

            case "FeelCold":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "Faint":
            {
                MyObject.Find("NPC/Puppy").GetComponent <PlayerStatus>().Faint();
                MyObject.SetObjectActive("NPC/Girl");
                break;
            }

            case "FirstInGirlHome":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "SeeGirlFather":
            {
                MyObject.SetObjectActive("Canvas/Aside");
                WeatherManager.Alternate();
                MyObject.SetObjectActive("NPC/Father");
                MyObject.SetObjectActive("NPC/Mother");
                MyObject.Find("NPC/Puppy").GetComponent <PlayerController>().SetDirection(1);
                break;
            }

            case "CallGirl":
            {
                MyObject.Find("NPC/Girl").GetComponent <GirlBehaviour>().SetStatus(1);
                break;
            }

            case "FatherMoveToSleep":
            {
                MyObject.Find("NPC/Father").GetComponent <FatherBehaviour>().SetStatus(0);
                break;
            }

            case "MotherLeaveHome":
            {
                MyObject.Find("NPC/Mother").GetComponent <MotherBehaviour>().SetStatus(0);
                break;
            }

            case "FollowGirlTerminal":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "ReturnBedroom":
            {
                MyObject.Find("NPC/Girl").GetComponent <GirlBehaviour>().SetStatus(2);
                break;
            }

            case "GirlSleep":
            {
                MyObject.Find("GirlHome/GirlBed").GetComponent <FurnitureBehaviour>().ChangeSprite(1);
                MyObject.SetObjectActive("NPC/Girl", false);
                break;
            }

            case "PuppySleep":
            {
                MyObject.Find("NPC/Puppy").GetComponent <PlayerStatus>().Faint();
                Invoke("ActiveAside", 2.0f);
                Invoke("PuppyWakeUp", 2.0f);
                break;
            }

            case "EncounterThief":
            {
                MyObject.SetObjectActive("NPC/Thief");
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "EncounterStranger":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");
                Invoke("GetBack", 2.0f);
                break;
            }

            case "HuskieSleep":
            {
                MyObject.Find("NPC/Huskie").transform.position = new Vector3(13.4f, -0.08f, -0.05f);
                MyObject.Find("NPC/Huskie").GetComponent <PlayerStatus>().Faint();
                MyObject.SetObjectActive("NPC/DreamYang");
                MyObject.Find("NPC/DreamYang").GetComponent <DreamYangBehaviour>().SetStatus(0);
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "SnowStop":
            {
                MyObject.SetObjectActive("Canvas/Aside");
                MyObject.Find("SnowSet").GetComponent <SnowManager>().ShutdownAllChildren();
                break;
            }

            case "YangShout":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "SeeHuskie":
            {
                MyObject.SetObjectActive("Canvas/Dialogue");
                break;
            }

            case "ApprochHuskie":
            {
                MyObject.Find("NPC/Huskie").GetComponent <HuskieBehaviour>().enabled = true;
                MyObject.Find("NPC/Huskie").GetComponent <HuskieBehaviour>().SetStatus(1);
                break;
            }

            default:
            {
                break;
            }
            }
        }
    }
Example #13
0
 //小狗醒来
 void PuppyWakeUp()
 {
     MyObject.Find("NPC/Puppy").GetComponent <PlayerStatus>().WakeUp();
 }
Example #14
0
 public void SetTarget(string targetName)
 {
     this.target        = MyObject.Find(targetName);
     transform.position = new Vector3(target.transform.position.x + 1, 2, -10);
     enabled            = true;
 }
Example #15
0
    public void Respond()
    {
        canClick = false;
        switch (targetName)
        {
        case "Huskie":
        {
            MyObject.SetObjectActive("Canvas/Dialogue");
            MyObject.Find("NPC/Huskie").GetComponent <HuskieBehaviour>().SetStatus(0);
            break;
        }

        case "Fridge":
        {
            MyObject.SetObjectActive("Canvas/Dialogue");
            break;
        }

        case "Telephone":
        {
            MyObject.SetObjectActive("Canvas/Dialogue");
            break;
        }

        case "Taxi":
        {
            HorizontalSmoothFollow.smoothing = 12.0f;
            MyObject.SetObjectActive("Canvas/Dialogue");
            MyObject.Find("YangYi").GetComponent <TakeCar>().GetOn();
            GetComponent <TaxiBehaviour>().enabled = true;
            break;
        }

        case "MCDonald":
        {
            MyObject.SetObjectActive("Canvas/Aside");
            HorizontalSmoothFollow.smoothing = 12.0f;
            GameObject _Taxi = GameObject.Find("PropSet/Taxi");
            if (_Taxi)
            {
                _Taxi.transform.localScale = new Vector3(-0.5f, 0.5f, 1.0f);
                _Taxi.transform.position   = new Vector3(120.0f, 0.05f, -0.1f);
            }
            GameObject _Player = GameObject.Find("YangYi");
            if (_Player)
            {
                _Player.transform.position   = new Vector3(120.44f, 0.05f, 0.05f);
                _Player.transform.localScale = new Vector3(-0.7f, 0.6f, 1.0f);
                _Player.transform.parent     = _Taxi.transform;
                _Player.GetComponent <PlayerController>().enabled = false;
                _Player.GetComponent <Animator>().enabled         = false;
                _Player.GetComponent <PlayerStatus>().isInCarrier = true;
            }
            if (_Taxi)
            {
                _Taxi.GetComponent <TaxiBehaviour>().enabled = true;
            }
            break;
        }

        case "Bed":
        {
            MyObject.SetObjectActive("Canvas/Aside");
            MyObject.SetObjectActive("NPC/Puppy");
            MyPlayer.SetPlayer("NPC/Puppy");
            MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().enabled = true;
            MyObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().SetTarget(MyPlayer.GetPlayer());
            WeatherManager.Alternate();
            MyObject.Find("AudioSet/BGM").GetComponent <BGMManager>().PlayBGM("ColdWind");
            break;
        }

        case "Thief":
        {
            MyObject.SetObjectActive("Canvas/Dialogue");
            Invoke("ThiefEscape", 3.0f);
            break;
        }

        default:
            break;
        }
    }
Example #16
0
    public void Click()
    {
        switch (buttonName)
        {
        case "ComeDown":
        {
            GameObject _Player = MyPlayer.GetPlayer();
            _Player.transform.position = new Vector3(239.59f, -0.38f, -0.2f);
            break;
        }

        case "ComeUp":
        {
            GameObject _Player = MyPlayer.GetPlayer();
            _Player.transform.position = new Vector3(239.59f, 1.86f, -0.2f);
            break;
        }

        case "ControlsButton":
        {
            GameObject.Find("Canvas").transform.GetChild(8).gameObject.SetActive(true);
            break;
        }

        case "CreditsButton":
        {
            GameObject.Find("Canvas").transform.GetChild(9).gameObject.SetActive(true);
            break;
        }

        case "ExitGameButton":
        {
            Application.Quit();
            break;
        }

        case "ExitHome":
        {
            MyObject.Find("AudioSet/BGM").GetComponent <BGMManager>().PlayBGM("Main_background_music");
            GameObject.Find("YangYi").transform.position = new Vector3(9.8f, -0.3f, -0.2f);
            GameObject.Find("Camera").transform.position = new Vector3(10.8f, 2, -10);
            GameObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().enabled = true;
            gameObject.SetActive(false);
            break;
        }

        case "GoHome":
        {
            MyObject.Find("AudioSet/BGM").GetComponent <BGMManager>().PlayBGM("YangHome");
            GameObject.Find("YangYi").transform.position = new Vector3(220.0f, -0.3f, -0.2f);
            GameObject.Find("Camera").transform.position = new Vector3(220, 2, -10);
            GameObject.Find("Camera").GetComponent <HorizontalSmoothFollow>().enabled = false;
            if (Dialogue.nowIndex == 22)
            {
                MyObject.SetObjectActive("PropSet/Taxi", false);
            }
            gameObject.SetActive(false);
            break;
        }

        case "MainMenuButton":
        {
            SceneManager.LoadScene("StartScene");
            break;
        }

        case "MaximizeButton":
        {
            GameObject.Find("Canvas/Task").transform.GetChild(0).gameObject.SetActive(true);
            GameObject.Find("Canvas/Task").transform.GetChild(1).gameObject.SetActive(true);
            gameObject.SetActive(false);
            break;
        }

        case "MinimizeButton":
        {
            GameObject.Find("Canvas/Task/Title").gameObject.SetActive(false);
            GameObject.Find("Canvas/Task/List").gameObject.SetActive(false);
            GameObject.Find("Canvas").transform.GetChild(2).gameObject.SetActive(true);
            break;
        }

        case "PassBy":
        {
            GameObject.Find("Canvas").transform.GetChild(0).gameObject.SetActive(false);
            break;
        }

        case "StartGameButton":
        {
            SceneManager.LoadScene("MainScene");
            break;
        }

        case "StoryButton":
        {
            GameObject.Find("Canvas").transform.GetChild(7).gameObject.SetActive(true);
            break;
        }

        default:
            break;
        }
    }
Example #17
0
 private void Awake()
 {
     MainCamera = MyObject.Find("Camera");
 }
Example #18
0
 //惊动爸爸
 void AlarmFather()
 {
     MyObject.Find("NPC/Father").GetComponent <FatherBehaviour>().SetStatus(1);
 }
Example #19
0
 //小偷逃离
 void ThiefEscape()
 {
     MyObject.Find("NPC/Thief").GetComponent <ThiefBehaviour>().SetStatus(0);
 }