Exemple #1
0
        private PlatformSlice InitializeSlice(GameObject slice, int colorId)
        {
            PlatformSlice pSlice = slice.AddComponent<PlatformSlice>();
            pSlice.colorId = colorId;
            pSlice.maxZ = sliceThicknessAnimationLimit;
            pSlice.dissolveTime = sliceDissolveTime;
            pSlice.dissolveTimeRange = sliceDissolveTimeRange;
            pSlice.dissolvePattern = sliceDissolvePattern;
            pSlice.panicEscapeSpeed = slicePanicEscapeSpeed;
            pSlice.panicSpinSpeed = slicePanicSpinSpeed;

            return pSlice;
        }
        public void OnPlayerCollision(GameObject collided)
        {
            if (tower.GameState != GameState.InProgress)
            {
                return;
            }

            if (collided == null)
            {
                return;
            }

            PlatformSlice slice = collided.GetComponent <PlatformSlice>();

            if (slice == null)
            {
                return;
            }

            HitResult hitResult = tower.HitCheck(playerBall.colorId, slice.colorId);

            platformList.Remove(slice.ParentPlatform);

            if (hitResult.playerDead)
            {
                slice.ParentPlatform.Dissolve(panic: true);
                DestroyAllPlatforms();
            }
            else
            {
                if (hitResult.successfulHit)
                {
                    slice.ParentPlatform.Dissolve();
                }
                else
                {
                    slice.ParentPlatform.Dissolve(panic: true);
                }

                PushPlatform();
                UpdateBallColor();
            }
        }
Exemple #3
0
        public GameObject GeneratePlatform(Engine.IDifficulty diff, AColorServer colorServer)
        {
            GameObject platformGO = new GameObject();
            platformGO.name = "Platform";
            Platform platform = platformGO.AddComponent<Platform>();

            arc = 360f / diff.MaxSlots;

            float lastYRot = Random.Range(0f, 360f);
            for (int i = 0; i < diff.MaxSlots; i++)
            {
                int colorId = diff.NextSlot();

                Material mat = MakeMaterial(colorId, diff.MaxSlots, colorServer);
                GameObject slice = MakeSlice(mat, platform.transform, lastYRot);
                PlatformSlice pSlice = InitializeSlice(slice, colorId);

                platform.InsertSlice(pSlice);
                lastYRot += arc;
            }

            return platformGO;
        }
Exemple #4
0
 public void InsertSlice(PlatformSlice slice)
 {
     slices.Add(slice);
 }