示例#1
0
        private void makeHole(GameObject plane, GameObject go)
        {
            // Preparing CSG objects for substraction.
            // Again, passing a new refference to the same mesh is important for some reason.
            CSG planeToCut = CSG.fromMesh(plane.GetComponent <MeshFilter>().mesh, plane.transform);
            CSG formCutter = CSG.fromMesh(go.GetComponent <MeshFilter>().mesh, go.transform);

            // Save the operation, this does not affect neither meshes yet.
            CSG  result     = planeToCut.subtract(formCutter);
            Mesh resultMesh = result.toMesh();

            // Replace the mesh of THIS object with the mesh representation of the operation.
            plane.GetComponent <MeshFilter>().mesh         = resultMesh;
            plane.GetComponent <MeshCollider>().sharedMesh = resultMesh;

            plane.transform.position   = new Vector3(0, 0, 0);
            plane.transform.localScale = Vector3.one;

            PlaneBehaviour pb = plane.GetComponent <PlaneBehaviour>();

            if (pb)
            {
                pb.updateStartPosition(plane.transform.position);
            }
        }
示例#2
0
 public void AddPlane(PlaneBehaviour plane)
 {
     plane.SubscribeToFly(AddFreePlane);
     _stackPlane.Push(plane);
     _prevPlane = plane;
     OnCreatePlane?.Invoke(_stackPlane.Count);
 }
示例#3
0
 //Called once when this object initializes
 void Start()
 {
     plane          = GetComponent <AeroPlane>();
     turnCooldown   = new Timers.CooldownTimer(3);
     planeBehaviour = GetComponent <PlaneBehaviour>();
     enemy          = GameHandler.Instance.Player;
 }
示例#4
0
 public void Initialize(PlaneBehaviour plane, int planeCount)
 {
     _plane = plane;
     NewPlane(planeCount.ToString());
     _plane.GetComponent <PlaneMoveController>().OnSpeedChange += ChangeSpeed;
     _plane.SubscribeToState(ChangeState);
 }
示例#5
0
 public IdleState(PlaneBehaviour owner)
 {
     _owner      = owner;
     _maxDist    = owner.MaxDistancePos;
     IsIgnore    = false;
     IsCanBePrev = true;
 }
示例#6
0
        public void StartFreePlane(ShipBehaviour ship)
        {
            var plane = GetFreePlane();

            if (plane == null)
            {
                return;
            }
            plane.transform.position = transform.position + new Vector3(.5f, .5f, 0);
            plane.gameObject.SetActive(true);
            plane.RestartPlane();
            _prevPlane = plane;
        }
示例#7
0
        private void CreatePlaneUi(PlaneBehaviour plane)
        {
            var ui = Instantiate(prefab, transform);

            if (_listPlaneUi.Count > 0)
            {
                ui.transform.position = _listPlaneUi.Last().transform.position + offset;
            }
            _listPlaneUi.Add(ui);
            ui.GetComponent <PlaneUi>().Initialize(plane, _listPlaneUi.Count);
            if (_listPlaneUi.Count == ship.GetPlaneCount)
            {
                ship.GetComponent <CreatePlane>().OnNewPlane -= CreatePlaneUi;
            }
        }
示例#8
0
    public void FindPlanes(AbstractPlaneFinder.Type type, bool showPlanes)
    {
        PlaneBehaviour.DeletePlanesIn(this.transform);
        this.transform.DeleteRoofMeshes();
        var planeClassifier = AbstractPlaneFinder.Instantiate(type, this.PointCloud);

        planeClassifier.Classify();
        planeClassifier.RemoveGroundPlanesAndVerticalPlanes();
        if (showPlanes)
        {
            foreach (var tuple in planeClassifier.PlanesWithScore.OrderByDescending(t => t.Value2).Take(6))
            {
                var plane = tuple.Value1;
                PlaneBehaviour.DisplayPlane(plane, this);
            }
        }

        this.PointCloud.Planes = planeClassifier.GetPlanes();
    }
示例#9
0
    private void Start()
    {
        // Delegates and event suscriptions
        this.levelController  = LevelController.Instance;
        this.playerController = PlayerController.Instance;
        this.uiController     = GameInputController.Instance;

        this.uiController.resetGameEvent += resetTransformAttempts;

        if (xPlane)
        {
            xPlaneBehaviour = xPlane.GetComponent <PlaneBehaviour>();
        }

        if (zPlane)
        {
            zPlaneBehaviour = zPlane.GetComponent <PlaneBehaviour>();
        }

        setAndInitCurrentLevel();
    }
示例#10
0
 private void AddFreePlane(PlaneBehaviour plane)
 {
     _freeStackPlane.Push(plane);
     OnCountFreePlaneChanged?.Invoke(_freeStackPlane.Count);
 }
示例#11
0
 public EvadeState(PlaneBehaviour owner)
 {
     _owner      = owner;
     IsIgnore    = false;
     IsCanBePrev = false;
 }
示例#12
0
 public BackState(PlaneBehaviour owner)
 {
     _owner      = owner;
     IsIgnore    = true;
     IsCanBePrev = false;
 }
示例#13
0
 public RefuelState(PlaneBehaviour owner)
 {
     _ownerRb = owner.GetRb;
     _ship    = owner.Ship;
 }
示例#14
0
 void Start()
 {
     spriteAnimator = GetComponent <SpriteAnimator>();
     planeBehaviour = GetComponent <PlaneBehaviour>();
 }
示例#15
0
 public PursuitState(PlaneBehaviour owner, Camera cam)
 {
     _owner      = owner;
     IsCanBePrev = true;
     _cam        = cam;
 }