Ejemplo n.º 1
0
        public void CanMoveVerticallyWhenStandingOnCollider()
        {
            var goPosition = new Vector2(0, 1);
            var go         = SetupCollider(
                name: "go",
                layer: 0,
                position: goPosition,
                size: Vector2.one * 2
                );
            PhysicsMovement physicsMovement = SetupPhysicsMovement(go);

            var hitPosition = new Vector2(0, -1);
            var floor       = SetupCollider(
                name: "floor",
                layer: 1,
                position: hitPosition,
                size: new Vector2(10, 2)
                );

            float exptecedVerticalMove = 2;

            float allowedMoveLeft = physicsMovement.GetAllowedMovement(exptecedVerticalMove, Direction4.Left);

            Assert.That(allowedMoveLeft, Is.EqualTo(exptecedVerticalMove));

            float allowedMoveRight = physicsMovement.GetAllowedMovement(exptecedVerticalMove, Direction4.Right);

            Assert.That(allowedMoveRight, Is.EqualTo(exptecedVerticalMove));
        }
Ejemplo n.º 2
0
 private void MoveEffectables(Dir4 dir, float moveAmount)
 {
     foreach (StandEffectable effectable in carryEffector.GetEffectables())
     {
         PhysicsMovement movement = effectable.GetComponent <PhysicsMovement>();
         movement.TryToMove(moveAmount, dir);
     }
 }
Ejemplo n.º 3
0
    void Start () {
        rc = FindObjectOfType<RadarController>();
        sp = FindObjectOfType<ShipPanel>();
        Player = GameObject.FindGameObjectWithTag("Player");
        tc = FindObjectOfType<TestCamera>();
        HUD = FindObjectOfType<playerHUD>();
        tg = FindObjectOfType<Targeting>();
        pm = FindObjectOfType<PhysicsMovement>();
        mycontrol = GetComponent<dfControl>();
        mycontrol.CanFocus = true;
        mainCamera = Camera.main;           
	}
Ejemplo n.º 4
0
    public void Mark()
    {
        if (markLocate == null)
        {
            PhysicsMovement mark = Instantiate(marker, cannon.shooter.position, cannon.shooter.rotation) as PhysicsMovement;

            mark.transform.parent = transform;

            markLocate = mark.GetComponent <Transform> ();

            //mark.velocity = cannon.shooter.forward * cannon.forwardV;
        }
    }
Ejemplo n.º 5
0
        public void CannotMoveDownWhenStandingOnCollider()
        {
            var goPosition = new Vector2(0, 1);
            var go         = SetupCollider(
                name: "go",
                layer: 0,
                position: goPosition,
                size: Vector2.one * 2
                );
            PhysicsMovement physicsMovement = SetupPhysicsMovement(go);

            var floorPosition = new Vector2(0, -1);
            var floor         = SetupCollider(
                name: "floor",
                layer: 1,
                position: floorPosition,
                size: new Vector2(10, 2)
                );

            float allowedMoveDown = physicsMovement.GetAllowedMovement(2, Direction4.Down);

            Assert.That(allowedMoveDown, Is.EqualTo(0));
        }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     pMovement = gameObject.GetComponent <PhysicsMovement> ();
 }
Ejemplo n.º 7
0
 void Awake()
 {
     player = this;
 }
Ejemplo n.º 8
0
 private void Start()
 {
     _playerMoveScript = GetComponent <PhysicsMovement>();
     _spriteRenderer   = GetComponent <SpriteRenderer>();
     _animator         = GetComponent <Animator>();
 }
Ejemplo n.º 9
0
 private void Start()
 {
     _boxCollider2D   = GetComponent <BoxCollider2D>();
     _physicsMovement = GetComponent <PhysicsMovement>();
     isDead           = false;
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     pMovement = gameObject.GetComponent<PhysicsMovement> ();
 }
 private void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <PhysicsMovement>();
 }
 // TODO: Introduce crushable
 private bool IsCrushingComponent(PhysicsMovement wantsToMove)
 {
     return(wantsToMove.GetComponent <PushBlock>() || wantsToMove.GetComponent <UnlockableDoor>());
 }
Ejemplo n.º 13
0
 private void Awake()
 {
     mov  = GetComponent <PhysicsMovement> ();
     anim = GetComponent <Animator> ();
     rb   = GetComponent <Rigidbody> ();
 }
Ejemplo n.º 14
0
 public void Shoot()
 {
     PhysicsMovement projectile = Instantiate(bullet, shooter.position, shooter.rotation) as PhysicsMovement;
     //projectile.velocity = new Vector3 (0, 0, forwardV);
     //projectile.velocity = shooter.forward * forwardV;
 }