コード例 #1
0
    public IEnumerator ReloadLoadSceneSmoth()
    {
        _resetingPosition = true;
        _roy   = null;
        _klunk = null;
        bool ok = false;

        LeanTween.value(gameObject, (x) => { _hidder.alpha = x; }, 0, 1, _fadeInTime)
        .setEase(_fadeInType)
        .setOnComplete(() =>
        {
            ok = true;
        });
        yield return(new WaitUntil(() => { return ok; }));

        yield return(SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex));

        LeanTween.value(gameObject, (x) => { _hidder.alpha = x; }, 1, 0, _fadeOutTime)
        .setEase(_fadeOutType);
        _resetingPosition = false;
        SceneFlow currentSceneFlow = FindObjectOfType <SceneFlow>();

        if (currentSceneFlow == null)
        {
            Destroy(gameObject);
            yield break;
        }
        _bounds     = currentSceneFlow._bounds;
        _finishZone = currentSceneFlow._finishZone;
        _roy        = FindObjectOfType <Roy>();
        _klunk      = FindObjectOfType <Klunk>();
        Destroy(currentSceneFlow.gameObject);
    }
コード例 #2
0
        public void Draw(SpriteBatch spriteBatch, int screenWidth, int screenHeight)
        {
            spriteBatch.Draw(Background, new Rectangle(0, 0, screenWidth, screenHeight), Color.White);

            int d = (int)Roy.Position.X + Roy.Bounds.Width / 2 - screenWidth / 2;

            d = MathHelper.Clamp(d, 0, LevelWidth - screenWidth);
            Rectangle screenWorldRect = new Rectangle(d, 0, screenWidth, screenHeight);

            foreach (Tile tile in Tiles)
            {
                if (tile.Bounds.Intersects(screenWorldRect))
                {
                    tile.Draw(spriteBatch, d);
                }
            }

            foreach (Entity entity in Entities)
            {
                if (entity.Bounds.Intersects(screenWorldRect))
                {
                    entity.Draw(spriteBatch, d);
                }
            }

            Roy.Draw(spriteBatch, d);
        }
コード例 #3
0
        public void Update(GameTime gameTime)
        {
            Roy.Update(gameTime);

            foreach (Entity entity in Entities)
            {
                entity.Update(gameTime);
            }
        }
コード例 #4
0
    private void Awake()
    {
        _roy   = FindObjectOfType <Roy>();
        _klunk = FindObjectOfType <Klunk>();

        _roy.OnCurrentEnergyChange += _roy_OnCurrentEnergyChange;
        _roy.OnCurrentFuelChange   += _roy_OnCurrentFuelChange;

        _klunk.OnCurrentEnergyChange += _klunk_OnCurrentEnergyChange;
        _klunk.OnCurrentFuelChange   += _klunk_OnCurrentFuelChange;
    }
コード例 #5
0
    private void OnTriggerEnter(Collider other)
    {
        Roy possivleRoy = other.GetComponent <Roy>();

        if (!possivleRoy)
        {
            return;
        }

        possivleRoy.AddBattery();
        Destroy(gameObject);
    }
コード例 #6
0
    private void Awake()
    {
        savePath   = Path.Combine(Application.persistentDataPath, "saveFile");
        royStats   = GameObject.Find("Set_PlayerRoy").GetComponent <Roy>();
        klunkStats = GameObject.Find("Set_KLUNK").GetComponent <Klunk>();

        if (File.Exists(savePath))
        {
            Vector2[] stats = LoadStats();
            royStats.SetCurrentHpSp(stats[0]);
            klunkStats.SetCurrentHpSp(stats[1]);
        }
    }
コード例 #7
0
    public void Pick(float perSecond)
    {
        OnPump?.Invoke();
        Roy roy = GetComponent <Roy>();

        if (roy)
        {
            roy.DecreaseFuel(perSecond);
            return;
        }
        Klunk klunk = GetComponent <Klunk>();

        if (klunk)
        {
            klunk.DecreaseFuel(perSecond);
        }
    }
コード例 #8
0
 private void Awake()
 {
     DontDestroyOnLoad(gameObject);
     _roy   = FindObjectOfType <Roy>();
     _klunk = FindObjectOfType <Klunk>();
 }