Ejemplo n.º 1
0
 /// <summary>
 /// Initializes variables
 /// </summary>
 void Start()
 {
     animCon = GetComponent <PlayerAnimationController>();
     sr      = GetComponent <SpriteRenderer>();
     invCon  = GetComponent <InventoryController>();
     colCon  = GetComponent <CollisionController>();
 }
Ejemplo n.º 2
0
 public void handleBoxColliderSimilarities(CollisionController colController)
 {
     colController.initBoxCollider();
     colController.ColliderScale     = boxScale;
     colController.ColliderIsTrigger = true;
     colController.setupInterfaces(this, this);
 }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     collisions       = GetComponent <CollisionController> ();
     directionalInput = new Vector2();
     velocity         = new Vector2();
     spriteRenderer   = GetComponent <SpriteRenderer> ();
 }
            // Register the Vessel-Handler and stop the GarbageCollection
            public void Start()
            {
                // Create the Singelton
                if (Instance != null)
                    Destroy(this);
                else
                    Instance = this;

                // Register the Handler
                GameEvents.onVesselDestroy.Add(onVesselDestroy); // Use another hook?

                // Stop the GC
                DontDestroyOnLoad(this);

                // Add the Terrain-Handler to all bodies
                foreach (CelestialBody body in PSystemManager.Instance.localBodies.Where(b => b.pqsController != null))
                {
                    GameObject modObject = new GameObject("TerrainDeformation");
                    modObject.transform.parent = body.pqsController.transform;
                    PQSMod_TerrainDeformation mod = modObject.AddComponent<PQSMod_TerrainDeformation>();
                    mod.deformations = new List<Deformation>();
                    mod.order = int.MaxValue; // Make sure that we're the last mod
                    mod.modEnabled = true;
                    mod.sphere = body.pqsController;
                }
            }
Ejemplo n.º 5
0
 private void Start()
 {
     playerMovement      = GetComponent <PlayerMovement>();
     collisionController = GetComponent <CollisionController>();
     coll        = GetComponent <BoxCollider>();
     timeElapsed = timeBetweenChecks;
 }
Ejemplo n.º 6
0
    public override void _Ready()
    {
        try
        {
            controller = GetNode("../Control") as Controller;

            players = controller.GetPlayerList();

            GD.Print("test");
            PackedScene res = GD.Load("res://CollisionController.tscn") as PackedScene;

            for (byte i = 0; i < players.Count; i++)
            {
                CollisionController cc = res.Instance() as CollisionController;
                AddChild(cc);
                cc.SetPosition(new Vector2(cc.GetSize().x *i, cc.GetPosition().y));
                cc.setTitle(players[i].GetName().ToString());
                cc.setOwner(players[i]);
                //listCollisionControlers.Add(cc);
            }
            GD.Print("passed fior");
        }
        catch (Exception e)
        {
            throw new Exception(e.Message);
        }

        GD.Print("what the f**k");
    }
Ejemplo n.º 7
0
 public void OnTriggerEnter(Collider other)
 {
     if (!CollisionController.IsIgnored(other.tag))
     {
         agent.Punish();
     }
 }
 // Since there are overlaps for the Press and Hover inits (below), we take those duplicate lines out and put them in here
 public void handleCircleColliderSimilarities(CollisionController colController)
 {
     colController.initCapsuleCollider();
     colController.ColliderDirection = direction;
     colController.ColliderIsTrigger = true;
     colController.ColliderScale     = colScale;
     colController.setupInterfaces(this, this);
 }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     controller         = GetComponent <CollisionController> ();
     velocityXSmoothing = 0f;
     willpower          = willpowercapacity;
     resting            = false;
     restrate           = normrestrate;
 }
Ejemplo n.º 10
0
 public void OnTriggerStay(Collider other)
 {
     if (CollisionController.IsIgnored(other.tag))
     {
         return;
     }
     isWall = true;
 }
Ejemplo n.º 11
0
        // Physics Stage
        private void ResolvePhysics(GameState s, float dt)
        {
            RTSTeam team;

            // Initialize hash grid
            var hashGrid = s.CGrid;

            hashGrid.ClearDynamic();

            // Move Geometry To The Unit's Location and hash into the grid
            for (int ti = 0; ti < s.activeTeams.Length; ti++)
            {
                team = s.activeTeams[ti].Team;
                foreach (RTSUnit unit in team.Units)
                {
                    unit.CollisionGeometry.Center = unit.GridPosition;
                    hashGrid.Add(unit);
                }
            }

            // Use hash grid to perform collision using 3 by 3 grid around the geometry
            for (int i = 0; i < hashGrid.ActiveGrids.Count; i++)
            {
                Point p = hashGrid.ActiveGrids[i];
                hashGrid.HandleGridCollision(p.X, p.Y);
                hashGrid.HandleGridCollision(p.X, p.Y, -1, -1);
                hashGrid.HandleGridCollision(p.X, p.Y, -1, 0);
                hashGrid.HandleGridCollision(p.X, p.Y, -1, 1);
                hashGrid.HandleGridCollision(p.X, p.Y, 0, -1);
                hashGrid.HandleGridCollision(p.X, p.Y, 0, 1);
                hashGrid.HandleGridCollision(p.X, p.Y, 1, -1);
                hashGrid.HandleGridCollision(p.X, p.Y, 1, 0);
                hashGrid.HandleGridCollision(p.X, p.Y, 1, 1);
            }

            // Move Unit's Location To The Geometry After Heightmap Collision
            for (int ti = 0; ti < s.activeTeams.Length; ti++)
            {
                team = s.activeTeams[ti].Team;
                foreach (RTSUnit unit in team.Units)
                {
                    CollisionController.CollideHeightmap(unit.CollisionGeometry, s.CGrid);
                    unit.GridPosition = unit.CollisionGeometry.Center;
                    unit.Height       = unit.CollisionGeometry.Height;

                    // Check To Make Sure Unit Is Inside The Map
                    if (unit.GridPosition.X < 0 || unit.GridPosition.X > s.CGrid.size.X ||
                        unit.GridPosition.Y < 0 || unit.GridPosition.Y > s.CGrid.size.Y
                        )
                    {
                        // Damage The Unit If It Is Outside
                        unit.Damage(1);
                    }
                }
            }
        }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     controller         = GetComponent <CollisionController> ();
     velocityXSmoothing = 0f;
     //willpower = willpowercapacity;
     //resting = false;
     player          = GameObject.FindGameObjectWithTag("Player");
     jumpangle       = jumpangle * Mathf.Deg2Rad;
     charscenechange = GetComponent <CharacterSceneChanger> ();
 }
Ejemplo n.º 13
0
    private double Distance(Collider other)
    {
        if (CollisionController.IsIgnored(other.tag))
        {
            return(defaultDistance);
        }
        var carPos = GetCarPosition();

        return(Vector3.Distance(other.ClosestPoint(carPos), carPos));
    }
Ejemplo n.º 14
0
        private void InitializeControllers()
        {
            displayController          = new DisplayController();
            npcController              = new NPCController();
            playerController           = new PlayerController();
            itemController             = new ItemController();
            obstacleController         = new ObstacleController();
            levelController            = new LevelController();
            entityGenerationController = new EntityGenerationController();
            xmlController              = new XMLController();
            tileController             = new TileController();
            collisionController        = new CollisionController();

            //set collision controller
            collisionController.tileController = tileController;

            //set entity generation controller
            entityGenerationController.itemController     = itemController;
            entityGenerationController.npcController      = npcController;
            entityGenerationController.obstacleController = obstacleController;

            //set xmlController
            xmlController.playerController   = playerController;
            xmlController.npcController      = npcController;
            xmlController.obstacleController = obstacleController;
            xmlController.itemController     = itemController;

            //set tile controller
            tileController.itemController     = itemController;
            tileController.npcController      = npcController;
            tileController.obstacleController = obstacleController;
            tileController.max_game_height    = MAX_GAME_HEIGHT;
            tileController.max_game_width     = MAX_GAME_WIDTH;
            tileController.tileSize           = PlayerController.SPRITE_SIZE;
            npcController.tileController      = tileController;
            itemController.tileController     = tileController;
            obstacleController.tileController = tileController;
            tileController.InitializeTiles();

            //set player controller
            playerController.itemController      = itemController;
            playerController.collisionController = collisionController;
            playerController.obstacleController  = obstacleController;

            //set level controller
            levelController.itemController     = itemController;
            levelController.obstacleController = obstacleController;
            levelController.playerController   = playerController;
            levelController.npcController      = npcController;
            levelController.tileController     = tileController;
            levelController.xmlController      = xmlController;

            //set npc controller
            npcController.collisionController = collisionController;
        }
Ejemplo n.º 15
0
    private void Awake()
    {
        UpdateKinematics();
        collisionController = GetComponent <CollisionController>();
        dialogueManager     = GetComponent <DialogueManager>();

        // Quick hack, need this initialized on the first frame.
        collisionInfo           = new CollisionController.CollisionInfo();
        collisionInfo.colliders = new Dictionary <Vector3, Collider>();
        soundController         = GetComponent <SoundController>();
    }
Ejemplo n.º 16
0
 private void InitializeCollisionController()
 {
     this.c_collisionController = new CollisionController(ref c_playerData,
                                                          ref c_positionData,
                                                          ref c_collisionData,
                                                          ref CollisionData,
                                                          ref c_aerialMoveData,
                                                          ref PlayerCollider,
                                                          GroundCollisionMask,
                                                          ZoneCollisionMask);
 }
Ejemplo n.º 17
0
    void Start()
    {
        // Rigid body de las pelota
        leftRb  = this.transform.Find("Left Ball").gameObject.GetComponent <Rigidbody> ();;
        rightRb = this.transform.Find("Right Ball").gameObject.GetComponent <Rigidbody> ();

        // Setea la velocidad maxima a cero
        leftMaxSpeed = rightMaxSpeed = 0;

        collisionController = GetComponent <CollisionController> ();
    }
Ejemplo n.º 18
0
        private void InitControllers()
        {
            Movement   = new MovementController();
            Weapon     = new WeaponController();
            Projectile = new ProjectileController();
            Collision  = new CollisionController();
            Health     = new HealthController();

            _enemies       = new List <EnemyController>();
            _shipsToRemove = new List <FieldEntity>();
        }
Ejemplo n.º 19
0
    private void Start()
    {
        collisionController = GetComponent <CollisionController>();
        PlayerMovement playerMovement = GameObject.FindWithTag("Player").GetComponent <PlayerMovement>();

        gravity          = playerMovement.GetGravity();
        terminalVelocity = playerMovement.GetTerminalVelocity();
        child            = transform.Find("Pickaxe");
        playerTransform  = playerMovement.transform;
        rend             = child.GetComponent <SpriteRenderer>();
        mineController   = playerTransform.GetComponent <MineController>();
    }
Ejemplo n.º 20
0
    // Come up with a better method name
    public void betterMethodName(JSONNode jsonNode, GameObject menuItem)
    {
        hoverObject     = menuItem.transform.FindChild("hover").gameObject;
        hoverController = hoverObject.GetComponent <CollisionController>();

        pressObject     = menuItem.transform.FindChild("press").gameObject;
        pressController = pressObject.GetComponent <CollisionController>();

        iconController = menuItem.GetComponent <IconController>();

        audioController = GameObject.Find("MenuHolder").GetComponent <AudioController>();
    }
 // Use this for initialization
 void Start()
 {
     timeToTrigger = 0.5f;
     lm = GameObject.FindGameObjectWithTag("LevelManager");
     _ac = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioControl>();
     lmScript = lm.GetComponent<LevelManagement>();
     //Needed for collider detection
     if (lmScript.TriggerByCollider)
     {
         _cc = TriggerCollider.GetComponent<CollisionController>();
     }
     //Needed for Has been seen detection
     _renderer = this.gameObject.GetComponent<Renderer>();
 }
Ejemplo n.º 22
0
    private void Start()
    {
        dead = false;

        sprite     = GetComponent <SpriteRenderer>();
        anim       = GetComponent <Animator>();
        hitbox     = GetComponent <BoxCollider2D>();
        controller = GetComponent <CollisionController>();

        gravity         = (2 * maxJumpHeight) / Mathf.Pow(timeToApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToApex;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);

        cameraController.MoveCamera(transform.position);
    }
Ejemplo n.º 23
0
 private void Awake()
 {
     if (collisions == null)
     {
         collisions = FindObjectOfType <CollisionController>();
     }
     if (input == null)
     {
         input = FindObjectOfType <InputController>();
     }
     if (ui == null)
     {
         ui = FindObjectOfType <UIController>();
     }
 }
        public override void Execute()
        {
            if (!BattlegroundController.FightSoundPlayed)
            {
                AudioController.PlaySound(AudioController.NarratorFightSoundInstance);
                BattlegroundController.FightSoundPlayed = true;
            }

            AudioController.PlaySound(AudioController.BattleSongInstance);
            InputController.CheckPlayerInput();

            CollisionController.CheckForWindowCollisions(BattlegroundController.FirstFighter);
            CollisionController.CheckForWindowCollisions(BattlegroundController.SecondFighter);

            CollisionController.CheckForMovementCollision();

            CollisionController.CheckForAttackCollision(
                BattlegroundController.FirstFighter,
                BattlegroundController.FirstFighterActions,
                BattlegroundController.SecondFighter,
                BattlegroundController.SecondFighterActions);

            CollisionController.CheckForAttackCollision(
                BattlegroundController.SecondFighter,
                BattlegroundController.SecondFighterActions,
                BattlegroundController.FirstFighter,
                BattlegroundController.FirstFighterActions);

            if (!BattlegroundController.DeadFighter)
            {
                if (BattlegroundController.FirstFighter.IsDead() || BattlegroundController.SecondFighter.IsDead())
                {
                    BattlegroundController.DeadFighter = true;
                    InputController.BlockInput         = true;

                    if (BattlegroundController.FirstFighter.IsDead())
                    {
                        BattlegroundController.FirstFighterActions["Die"].ToBeDrawn = true;
                        BattlegroundController.FirstFighterActions["Die"].Drawn     = false;
                    }
                    else
                    {
                        BattlegroundController.SecondFighterActions["Die"].ToBeDrawn = true;
                        BattlegroundController.SecondFighterActions["Die"].Drawn     = false;
                    }
                }
            }
        }
Ejemplo n.º 25
0
 public void Reset()
 {
     _directionForward = Vector3.right;
     _directionBackward = Vector3.left;
     _gravity = GetComponent<GravityController>();
     _collisionController = GetComponent<CollisionController>();
     _currentForwardSpeed = 0;
     _currentBackwardSpeed = 0;
     _acceleration = 25.0f*1.5f;
     _damping = 0.3f;
     _maxSpeed = 15.0f*1.5f;
     _velocity = Vector3.zero;
     _force = Vector3.zero;
     _fromGravityToMovement = false;
     _isOn = false;
 }
Ejemplo n.º 26
0
        public static bool CanObjectBeSpawned()
        {
            if (_spawnView == null)
            {
                return(false);
            }

            CollisionController _controller = _spawnView.GetComponent <CollisionController>();

            if (_controller != null)
            {
                return(!_controller.IsBlocked());
            }

            return(false);
        }
Ejemplo n.º 27
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Bullet")
     {
         //Animation
         CollisionController.Get().SpawnExploder(transform.position);
         gameObject.SetActive(false);
         AudioController.hitEnemy.Play();
     }
     if (collision.gameObject.tag == "Player")
     {
         //Animation
         CollisionController.Get().SpawnExploder(transform.position);
         Player.Get().RockCrashCash();
         gameObject.SetActive(false);
     }
 }
Ejemplo n.º 28
0
    void Start() {
        // Add the platform's position as the first waypoint and convert the local waypoints to global.
        globalWaypoints.Add(transform.position);
        foreach (Vector2 waypoint in waypoints) {
            globalWaypoints.Add(waypoint + (Vector2)transform.position);
        }

        collisionController = GetComponent<CollisionController>();
        if (moveableMask.value == 0) {
            Debug.LogWarning("Platform's movableMask has no layers!");
        } else if (moveableMask.Contains(gameObject.layer) || solidMask.Contains(gameObject.layer)) {
            Debug.LogWarning("One of the LayerMasks contains this object's layer!");
        }
        if (moveableMask.Overlaps(solidMask)) {
            Debug.LogWarning("SolidMask and MoveableMask have at least one layer in common, and they probably should have none.");
        }
    }
Ejemplo n.º 29
0
    // Use this for initialization
    void Start()
    {
        sc         = GameObject.FindGameObjectWithTag("ShapeController").GetComponent <ShapeController> ();
        cc         = GameObject.FindGameObjectWithTag("CollisionController").GetComponent <CollisionController> ();
        queues [0] = GameObject.FindGameObjectWithTag("Queue1");
        queues [1] = GameObject.FindGameObjectWithTag("Queue2");
        queues [1].SetActive(false);
        queues [2] = GameObject.FindGameObjectWithTag("Queue3");
        queues [2].SetActive(false);
        queues [3] = GameObject.FindGameObjectWithTag("Queue4");
        queues [3].SetActive(false);

        cols [0] = GameObject.FindGameObjectWithTag("Col1");
        cols [1] = GameObject.FindGameObjectWithTag("Col2");
        cols [2] = GameObject.FindGameObjectWithTag("Col3");
        cols [3] = GameObject.FindGameObjectWithTag("Col4");
    }
Ejemplo n.º 30
0
        private void OnAnyGrabEnd(object sender, ObjectInteraction.InteractableObjectEventArgs e)
        {
            if (!_isRoot)
            {
                return;
            }

            CollisionController collisionController = _gameObject.GetComponent <CollisionController>();

            if (collisionController != null)
            {
                collisionController.enabled = false;
                Object.Destroy(collisionController);
            }

            InputAdapter.Instance.PlayerController.Nodes.GetControllerReference(e.Hand).Controller.AddColliders(null);
        }
Ejemplo n.º 31
0
    public void CmdAttack()
    {
        //initiate bullet prefab
        GameObject bullet = Instantiate(Resources.Load("bullet")) as GameObject;

        bullet.transform.position = new Vector3(parts[1].position.x, parts[1].position.y, parts[1].position.z) + parts[1].forward * 3.0f;
        bullet.transform.rotation = parts [1].rotation;
        this.speed = speed;
        //set bullet atk
        CollisionController bulletCC = bullet.GetComponent <CollisionController>();

        bulletCC.ATK = bulletATK;
        //spawn bullet on client
        NetworkServer.Spawn(bullet);

        // set automatically detroy after 2.0 seconds
        Destroy(bullet, 2.0f);
    }
Ejemplo n.º 32
0
    public void CmdSpecialAttck()
    {
        //initiate rocket prefab
        GameObject rocket = Instantiate(Resources.Load("rocket")) as GameObject;

        //set rocket atk
        CollisionController rocketCC = rocket.GetComponent <CollisionController> ();

        rocketCC.ATK = rocketsATK;

        //移除一个火箭指示物,发动效果:这张卡在回合结束前可以发动一次火球
        rocketsCounter--;

        //spawn rocket on client
        NetworkServer.Spawn(rocket);

        //set automatically destroy
        Destroy(rocket, 2.0f);
    }
Ejemplo n.º 33
0
            // Constructor
            public AutoPilotManager(IMyGridTerminalSystem myGridTerminalSystem, UIManager uIManager, float powerFactor, int precisionFactor, int scanDistance)
            {
                List <IMyRemoteControl> controllers = new List <IMyRemoteControl>();

                myGridTerminalSystem.GetBlocksOfType(controllers);

                foreach (IMyRemoteControl c in controllers)
                {
                    remotePilot      = c;
                    controlReference = remotePilot;
                }
                wheelController      = new WheelController(myGridTerminalSystem, controlReference);
                this.powerFactor     = powerFactor;
                this.precisionFactor = precisionFactor;
                maxScanDistance      = scanDistance;
                state               = PilotState.DRIVING;
                this.uIManager      = uIManager;
                collisionController = new CollisionController(myGridTerminalSystem, remotePilot.GetValueBool("CollisionAvoidance"));
                uIManager.printOnScreens("service", $"Found {collisionController.cameras.Count} cameras for collision detection.");
            }
Ejemplo n.º 34
0
 void Start()
 {
     _movementController = GetComponent<MovementController>();
     _collisionController = GetComponent<CollisionController>();
     _localGravityDirection = Vector3.down;
     _globalGravityDirection = Vector3.down;
     _pushDirection = Vector3.up;
     Reset();
 }