Пример #1
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;
        }
Пример #2
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;
        }