示例#1
0
 // Use this for initialization
 void Start()
 {
     if (!Excersizer)
     {
         Excersizer = GameObject.FindObjectOfType <ExcersizeSharedScheduler> ();
     }
     ExcersizeAppState.main.EnsureSetup();
     ExcersizeAppState.main.State.OnMeridianChanged += UpdateFromState;
     UpdateFromState();
 }
示例#2
0
    void SetupExcersizeControls()
    {
        var book = GameObject.FindObjectOfType <BookAnimScript> ();

        Scheduler = (Scheduler != null) ? Scheduler : GameObject.FindObjectOfType <ExcersizeSharedScheduler> ();
        AbacusObj = (AbacusObj != null) ? AbacusObj : GameObject.FindObjectOfType <Abacus> ();

        var sched = this.Scheduler;

        book.OnPageChanged += ((int newPage) => {
            var ia = ((newPage / 2) % sched.Activities.Length);
            var act = sched.Activities[ia];
            sched.UpdateCurrentActivity(act);
            ExcersizeAppState.main.AudioManager.ChangeTrack(null);
        });
    }
示例#3
0
    public void EnsureSetup()
    {
        if (mIsSetup)
        {
            return;
        }
        mIsSetup = true;
        mMain    = this;

        State = new AppState();

        if (!this.Shared)
        {
            this.Shared = GameObject.FindObjectOfType <ExcersizeSharedScheduler> ();
        }
        this.AudioManager = GameObject.FindObjectOfType <VoiceOverEventManager> ();
    }
示例#4
0
    public void EnsureSetup()
    {
        if (isSetup)
        {
            return;
        }
        isSetup = true;

        FieldOverallAlpha = 1.0f;
        ParticleFlowRate  = 1.0f;
        if (!this.Body)
        {
            this.Body = this.gameObject.GetComponentInParent <BodyLandmarks> ();
        }
        if (!this.Body)
        {
            if (!this.Hand)
            {
                this.Hand = this.gameObject.GetComponentInParent <MainEnergyApp> ();
            }
            this.ChiBall = this.gameObject.GetComponentInParent <ChiHandEnergyBall> ();
        }
        Debug.Assert((this.Body) || (this.Hand) || (this.ChiBall));
        if (!this.ExcersizeSystem)
        {
            this.ExcersizeSystem = GameObject.FindObjectOfType <ExcersizeSharedScheduler> ();
        }
        bool isMobile = (Application.platform == UnityEngine.RuntimePlatform.IPhonePlayer);
        int  sideRes  = (isMobile ? this.VoxelSideResMobile : this.VoxelSideRes);      // 8;

        if (this.Body)
        {
            this.Body.EnsureSetup();
            int chakraToShow = CurrentFocusChakra;             //3;
            this.FieldsCells = new VolumeBuffer <DynFieldCell> (Cubic <int> .CreateSame(sideRes));
            var scl  = OneOver(this.FieldsCells.Header.Size.AsVector3());
            var l2w  = this.transform.localToWorldMatrix;
            var cntr = Body.Chakras.AllChakras [chakraToShow].transform.position;            //  l2w.MultiplyPoint (Vector3.zero);
            foreach (var nd in this.FieldsCells.AllIndices3())
            {
                var cell = this.FieldsCells.Read(nd.AsCubic());
                cell.Pos = this.transform.localToWorldMatrix.MultiplyPoint(FieldsCells.Header.CubicToDecimalUnit(nd) - (Vector3.one * 0.5f));
                if (!(SkipRandomPlacement))
                {
                    cell.Pos += Scale(Random.insideUnitSphere, scl);                      // add random offset
                }
                cell.Direction   = cntr - cell.Pos;
                cell.LatestColor = Color.white;
                cell.Twist       = 0.0f;
                cell.VoxelIndex  = nd;
                this.FieldsCells.Write(nd.AsCubic(), cell);
            }
        }
        else if (this.Hand)
        {
            var arrows = this.Hand.FindAllFlowNodes();
            var n      = arrows.Count;
            this.IsStaticLayout = true;
            this.FieldsCells    = new VolumeBuffer <DynFieldCell> (Cubic <int> .Create(n, 1, 1));
            for (int i = 0; i < n; i++)
            {
                var cell  = this.FieldsCells.Array [i];
                var arrow = arrows [i];
                cell.Pos                   = arrow.transform.position;
                cell.Direction             = arrow.transform.up * 50.0f;
                cell.LatestColor           = Color.green;
                cell.Twist                 = 0.0f;
                cell.VoxelIndex            = new Int3(i, 0, 0);
                this.FieldsCells.Array [i] = cell;
            }
        }
        else if (this.ChiBall)
        {
            this.FieldsCells = new VolumeBuffer <DynFieldCell> (Cubic <int> .CreateSame(sideRes));
            var scl  = OneOver(this.FieldsCells.Header.Size.AsVector3());
            var cntr = this.ChiBall.transform.position;
            var l2w  = this.transform.localToWorldMatrix;
            foreach (var nd in this.FieldsCells.AllIndices3())
            {
                var cell = this.FieldsCells.Read(nd.AsCubic());
                cell.Pos = this.transform.localToWorldMatrix.MultiplyPoint(FieldsCells.Header.CubicToDecimalUnit(nd) - (Vector3.one * 0.5f));
                if (!(SkipRandomPlacement))
                {
                    cell.Pos += Scale(Random.insideUnitSphere, scl);                      // add random offset
                }
                cell.Direction   = cntr - cell.Pos;
                cell.LatestColor = Color.white;
                cell.Twist       = 0.0f;
                cell.VoxelIndex  = nd;
                this.FieldsCells.Write(nd.AsCubic(), cell);
            }
        }

        this.UpdateCellFieldDir(snapToCurrent: true);
    }