Exemple #1
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "Slope")
     {
         SlopeHandler slopeHandler = other.gameObject.GetComponent <SlopeHandler>();
         Vector3      curPos       = transform.position;
         float        curY         = slopeHandler.GetYOnSlope(curPos);
         transform.position = new Vector3(curPos.x, curY, curPos.z);
     }
 }
Exemple #2
0
 void Awake()
 {
     player        = GameObject.FindGameObjectWithTag("Player");
     anim          = GetComponent <Animator> ();
     nav           = GetComponent <NavMeshAgent> ();
     playerStats   = player.GetComponent <PlayerStats>();
     currentHealth = startingHealth;
     EnemyMovement = GetComponent <EnemyMovement>();
     SlopeHandler  = GetComponentInChildren(typeof(SlopeHandler), true) as SlopeHandler;
 }
Exemple #3
0
 void OnTriggerExit(Collider other)
 {
     // GameTools.LogError("=== Exit ==");
     if (other.tag == "Slope")
     {
         SlopeHandler slopeHandler = other.gameObject.GetComponent <SlopeHandler>();
         Vector3      curPos       = transform.position;
         float        curY         = slopeHandler.GetYLeaveSlop(curPos);
         transform.position = new Vector3(curPos.x, curY, curPos.z);
     }
 }
Exemple #4
0
        public static bool Prefix(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation currentLocation, Farmer __instance)
        {
            try
            {
                Layer slope = currentLocation.map.GetLayer("Slope" + Pseudo3D.LevelHandler.getLevelSuffixForCharacter(__instance));
                if (slope != null && slope.Tiles[__instance.getTileX(), __instance.getTileY()] != null)
                {
                    SlopeHandler.modifyVelocity(__instance, slope.Tiles[__instance.getTileX(), __instance.getTileY()]);
                }
            }
            catch (NullReferenceException)
            {
            }
            string currentLevel = Pseudo3D.LevelHandler.getLevelForCharacter(__instance);
            string backLayer    = "Back" + Pseudo3D.LevelHandler.getLevelSuffixForCharacter(__instance);

            if (currentLocation.map.GetLayer(backLayer).Tiles[__instance.getTileX(), __instance.getTileY()] != null)
            {
                xTile.Tiles.Tile currentTile = currentLocation.map.GetLayer(backLayer).Tiles[__instance.getTileX(), __instance.getTileY()];
                if (currentTile.Properties.ContainsKey("Level"))
                {
                    Logger.log("Checking level...");
                    xTile.ObjectModel.PropertyValue layerSwitch = currentLocation.map.GetLayer(backLayer).Tiles[__instance.getTileX(), __instance.getTileY()].Properties["Level"];
                    string layer = layerSwitch.ToString();
                    if (layer.Equals("0"))
                    {
                        layer = "Base";
                    }
                    if (!currentLevel.Equals(layer))
                    {
                        Logger.log("Applying level " + layer + "...");
                        //Pseudo3D.MapHandler.setPassableTiles(currentLocation, layer);
                        Pseudo3D.LevelHandler.setLevelForCharacter(__instance, layer);
                    }
                }
            }
            //Logger.log("Colliding position? " + currentLocation.isCollidingPosition(__instance.nextPosition(__instance.facingDirection), viewport, true, 0, false, (Character)__instance).ToString());
            return(true);
        }