Ejemplo n.º 1
0
    private void OnTriggerExit(Collider other)
    {
        TerrainZone zone = other.GetComponent <TerrainZone>();

        if (zone != null)
        {
            _ExternalForceVector   = Vector3.zero;
            _TerrainVelocityScaler = 1;
        }
        else if (other.GetComponent <Interactable>() != null)
        {
            _InteractablesInRange.Remove(other.GetComponent <Interactable>());

            if (_LogInteractables)
            {
                print(other.GetComponent <Interactable>().gameObject.name + " out of range");
            }

            // if the trigger is the echidna and you are pushing
            if (_State == State.PushingEchidna && other.GetComponent <Interactable>().gameObject.GetComponent <EchidnaController>())
            {
                SetState(State.Roaming);
            }
        }
    }
Ejemplo n.º 2
0
    private void OnTriggerStay(Collider other)
    {
        TerrainZone zone = other.GetComponent <TerrainZone>();

        if (zone != null)
        {
            _RB.AddForce(zone.WorldSpaceForce);
        }
    }
Ejemplo n.º 3
0
    private void OnTriggerStay(Collider other)
    {
        TerrainZone zone = other.GetComponent <TerrainZone>();

        if (zone != null)
        {
            _ExternalForceVector = zone.WorldSpaceForce;
        }
    }
Ejemplo n.º 4
0
		public virtual void Initialize( TerrainZone tz,
			int tileSize, int pageSize, bool asyncLoading,
			TerrainZonePageSourceOptionList optionList )
		{
			mTerrainZone = tz;
			mTileSize = tileSize;
			mPageSize = pageSize;
			mAsyncLoading = asyncLoading;
		}
Ejemplo n.º 5
0
    private void OnTriggerEnter(Collider other)
    {
        TerrainZone zone = other.GetComponent <TerrainZone>();

        if (zone != null)
        {
            _TerrainVelocityScaler = zone._TerrainVelocityScaler;
        }
        else if (other.GetComponent <Interactable>() != null)
        {
            _InteractablesInRange.Add(other.GetComponent <Interactable>());

            if (_LogInteractables)
            {
                print(other.GetComponent <Interactable>().gameObject.name + " in range");
            }
        }
    }
		//-------------------------------------------------------------------------
		public override void Initialize( TerrainZone tsm, int tileSize, int pageSize, bool asyncLoading,
		                                 TerrainZonePageSourceOptionList optionList )
		{
			// Shutdown to clear any previous data
			Shutdown();

			base.Initialize( tsm, tileSize, pageSize, asyncLoading, optionList );

			// Get source image

			bool imageFound = false;
			this.mIsRaw = false;
			bool rawSizeFound = false;
			bool rawBppFound = false;
			foreach ( var opt in optionList )
			{
				string key = opt.Key;
				key = key.Trim();
				if ( key.StartsWith( "HeightmapImage".ToLower(), StringComparison.InvariantCultureIgnoreCase ) )
				{
					this.mSource = opt.Value;
					imageFound = true;
					// is it a raw?
					if ( this.mSource.ToLowerInvariant().Trim().EndsWith( "raw" ) )
					{
						this.mIsRaw = true;
					}
				}
				else if ( key.StartsWith( "Heightmap.raw.size", StringComparison.InvariantCultureIgnoreCase ) )
				{
					this.mRawSize = Convert.ToInt32( opt.Value );
					rawSizeFound = true;
				}
				else if ( key.StartsWith( "Heightmap.raw.bpp", StringComparison.InvariantCultureIgnoreCase ) )
				{
					this.mRawBpp = Convert.ToByte( opt.Value );
					if ( this.mRawBpp < 1 || this.mRawBpp > 2 )
					{
						throw new AxiomException(
							"Invalid value for 'Heightmap.raw.bpp', must be 1 or 2. HeightmapTerrainZonePageSource.Initialise" );
					}
					rawBppFound = true;
				}
				else if ( key.StartsWith( "Heightmap.flip", StringComparison.InvariantCultureIgnoreCase ) )
				{
					this.mFlipTerrainZone = Convert.ToBoolean( opt.Value );
				}
				else
				{
					LogManager.Instance.Write( "Warning: ignoring unknown Heightmap option '" + key + "'" );
				}
			}
			if ( !imageFound )
			{
				throw new AxiomException( "Missing option 'HeightmapImage'. HeightmapTerrainZonePageSource.Initialise" );
			}
			if ( this.mIsRaw && ( !rawSizeFound || !rawBppFound ) )
			{
				throw new AxiomException(
					"Options 'Heightmap.raw.size' and 'Heightmap.raw.bpp' must be specified for RAW heightmap sources. HeightmapTerrainZonePageSource.Initialise" );
			}
			// Load it!
			LoadHeightmap();
		}
Ejemplo n.º 7
0
		public TerrainZoneRenderable( string name, TerrainZone tsm )
			: base()
		{
			this.name = name;
			this.mTerrainZone = tsm;
			this.mTerrain = null;
			this.mPositionBuffer = null;
			this.mForcedRenderLevel = -1;
			this.mLastNextLevel = -1;
			this.mMinLevelDistSqr = null;
			this.mInit = false;
			this.mLightListDirty = true;
			castShadows = false;
			this.mNeighbors = new TerrainZoneRenderable[4];

			this.mOptions = this.mTerrainZone.Options;
		}