示例#1
0
 void PushObject()
 {
     targetObj           = target.GetComponent <MovingObj>();
     targetObj.isRunning = !targetObj.isRunning;
     target.transform.GetChild(1).gameObject.SetActive(false); //invisible footprints when moving
     targetObj.setPushForce(slider.value);
     CloseGaugeUI();
     isTargetPushed = true;
     isInFrontOfObj = false;
 }
示例#2
0
    public static string HarvesterRescue(int[][] data)
    {
        const string success   = "The spice must flow! Rescue the harvester!";
        const string fail      = "Damn the spice! I'll rescue the miners!";
        var          harvester = new Harvester(data[0][0], data[0][1]);
        var          worm      = new MovingObj(data[1][0], data[1][1], data[1][2]);
        var          carryall  = new MovingObj(data[2][0], data[2][1], data[2][2]);

        double w2hTime = Time(Distance(harvester.Location(), worm.Location()), worm.Speed());
        double c2hTime = Time(Distance(harvester.Location(), carryall.Location()), carryall.Speed());

        return(w2hTime - c2hTime > 1 ? success : fail);
    }
示例#3
0
    public static void AddObj(MovingObj obj)
    {
        if (movingObjs == null)
        {
            movingObjs = new Dictionary <string, MovingObj>();
        }

        if (movingObjs.ContainsKey(obj.name))
        {
            MyDebug.LogWarning($"Object with key {obj.name} already exists in list");
            return;
        }
        movingObjs.Add(obj.name, obj);
    }
示例#4
0
    private async void Awake()
    {
        MovingObjList.AddObj(this);
        startPos = transform.localPosition;

        MovingObj obj = this;

        await Task.Delay(1);

        if (obj == null)
        {
            return;
        }

        obj?.gameObject?.SetActive(!hideOnAwake);
    }
示例#5
0
 void checkObjectStatus()
 {
     CloseGaugeUI();
     FeedBackUI.SetActive(true);
     targetObj = target.GetComponent <MovingObj>();
     if (targetObj.hasExitedDestination)
     {
         FeedBackText.text = "You pushed too hard. Try again";
         retryBtn.onClick.AddListener(Putback);
     }
     else if (targetObj.hasEnteredDestination)
     {
         FeedBackText.text = "Great, You made it! Now move to the next.";
         retryBtn.onClick.AddListener(SolveOne);
     }
     else if (!targetObj.hasExitedDestination && !targetObj.hasEnteredDestination)
     {
         FeedBackText.text = "You need to push harder. Keep pushing";
         retryBtn.onClick.AddListener(KeepPush);
     }
 }