Esempio n. 1
0
 private void Grabbing(ContinentBlockController sourceContinent)
 {
     if (this.lastGrabbedContinent == sourceContinent &&
         this.CurrentTimeInMilliseconds <= this.grabStarted + this.gameConfiguration.grabTimeInSeconds * 1000)
     {
         this.grabProgression = (this.CurrentTimeInMilliseconds - this.grabStarted) / 1000 / this.gameConfiguration.grabTimeInSeconds;
         // if (this.grabProgression.Between(0.98f, 1f))
         // { this.Temp("Grabbing", "Progression: " + this.grabProgression); }
         this.grabbingProgressionEvent.Raise(this.grabProgression);
     }
 }
Esempio n. 2
0
        private void StartGrab(ContinentBlockController sourceContinent)
        {
            if (sourceContinent == null ||
                sourceContinent.Resource == ContinentBlockController.ResourceType.None)
            {
                return;
            }

            // this.Temp("StartGrab", "From: " + sourceContinent.name);
            this.lastGrabbedContinent = sourceContinent;
            this.grabbedResource      = sourceContinent.Resource;
            this.grabStarted          = this.CurrentTimeInMilliseconds;
        }
Esempio n. 3
0
        private void Release(ContinentBlockController targetContinent)
        {
            // Return if there is not grabbed resource or if the target continent expects a different resource.
            if (this.lastGrabbedContinent == null || this.grabProgression < 0.9f ||
                this.grabbedResource == ContinentBlockController.ResourceType.None ||
                targetContinent.Resource == ContinentBlockController.ResourceType.Water && this.grabbedResource != ContinentBlockController.ResourceType.Water)
            {
                return;
            }

            // this.Temp("Release", "On " + targetContinent.name);
            GameEventResourceDrop.ResourceDrop resourceDropped = new GameEventResourceDrop.ResourceDrop
            {
                resource    = this.grabbedResource,
                targetBlock = targetContinent,
                sourceBlock = this.lastGrabbedContinent
            };
            this.resourceDrop.Raise(resourceDropped);
            targetContinent.ResourceDropped(resourceDropped);

            this.lastGrabbedContinent = null;
            this.grabbedResource      = ContinentBlockController.ResourceType.None;
        }