// Start is called before the first frame update
    void Start()
    {
        //Get the components
        playerRB    = GetComponent <Rigidbody2D>();
        groundCheck = GameObject.Find("GroundCheck").GetComponent <GroundCheck>();
        wallCheck   = GameObject.Find("WallDetector").GetComponent <WallDetector>();

        wallJumpDirection.Normalize();
    }
示例#2
0
 void Start()
 {
     playerRigidbody     = GetComponent <Rigidbody2D>();
     playerStatus        = GetComponent <PlayerStatusManager>();
     animator            = GetComponent <Animator>();
     sprite              = GetComponent <SpriteRenderer>();
     groundDetector      = GetComponentInChildren <GroundDetector>();
     wallclimbDetector   = GetComponentInChildren <WallDetector>();
     IsGrounded          = false;
     HasMovementFreedom  = true;
     regularGravityScale = playerRigidbody.gravityScale;
 }
        private void Import()
        {
            ProgressValue   = 0.0;
            ProgressMessage = "Converting House Plan to Image";

            currentHousePlanName = System.IO.Path.GetFileNameWithoutExtension(fileName);
            currentHousePlan     = new HousePlan(currentHousePlanName);
            String currentHousePlanFileName = System.IO.Path.GetFullPath(string.Format(@"{0}\{1}.hpl",
                                                                                       System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\", housePlansDirectory), currentHousePlanName));
            Image <Bgr, byte>  image        = new Image <Bgr, byte>(fileName);
            Image <Gray, byte> currentImage = image.Convert <Gray, byte>();

            ProgressValue   = 2.9;
            ProgressMessage = "Generating house plan walls";

            List <Wall2D> walls = WallDetector.GetWalls(currentImage);

            ProgressValue   = 99.58;
            ProgressMessage = "Finalizing house plan";

            int    width  = currentImage.Width;
            int    height = currentImage.Height;
            double factor = 20000 / width;

            using (StreamWriter wr = new StreamWriter(currentHousePlanFileName))
            {
                for (int i = 0; i < walls.Count; i++)
                {
                    Point3d p1   = new Point3d(Convert.ToSingle((walls[i].Corners[0].X - width / 2) * factor), 0, Convert.ToSingle((walls[i].Corners[0].Y - height / 2) * factor));
                    Point3d p2   = new Point3d(Convert.ToSingle((walls[i].Corners[1].X - width / 2) * factor), 0, Convert.ToSingle((walls[i].Corners[1].Y - height / 2) * factor));
                    Point3d p3   = new Point3d(Convert.ToSingle((walls[i].Corners[2].X - width / 2) * factor), 0, Convert.ToSingle((walls[i].Corners[2].Y - height / 2) * factor));
                    Point3d p4   = new Point3d(Convert.ToSingle((walls[i].Corners[3].X - width / 2) * factor), 0, Convert.ToSingle((walls[i].Corners[3].Y - height / 2) * factor));
                    Wall    wall = new Wall(p1, p2, p3, p4);
                    currentHousePlan.AddWall(wall);
                    wr.WriteLine((int)p1.X + "," + (int)p1.Y + "," + (int)p1.Z + " " + (int)p2.X + "," + (int)p2.Y + "," + (int)p2.Z + " " +
                                 (int)p3.X + "," + (int)p3.Y + "," + (int)p3.Z + " " + (int)p4.X + "," + (int)p4.Y + "," + (int)p4.Z + " ");
                }
            }

            ProgressValue = 100;
        }
示例#4
0
 protected override void Start()
 {
     base.Start();
     wallDetector = GetComponentInChildren <WallDetector>();
     StartCoroutine(Expire());
 }