IntVector2.Equals C# (CSharp) Method

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
	public override bool Equals(object obj) {
		if (obj == null)
			return false;
		if (ReferenceEquals(this, obj))
			return true;
		if (obj.GetType() != typeof(IntVector2))
			return false;
		IntVector2 other = (IntVector2)obj;
		return x == other.x && y == other.y;
	}

Usage Example

Example #1
0
    public void OnKeydown(IntVector2 dir)
    {
        if (!turn)
        {
            return;
        }

        turn = false;

        StartCoroutine(Reset());
        print(stage.actors.Count);
        Action next = null;

        if (dir.Equals(Direction.NORTH))
        {
            next = new WalkAction(stage.hero, stage, Direction.NORTH);
        }
        else if (dir.Equals(Direction.EAST))
        {
            next = new WalkAction(stage.hero, stage, Direction.EAST);
        }
        else if (dir.Equals(Direction.SOUTH))
        {
            next = new WalkAction(stage.hero, stage, Direction.SOUTH);
        }
        else if (dir.Equals(Direction.WEST))
        {
            next = new WalkAction(stage.hero, stage, Direction.WEST);
        }

        if (next != null)
        {
            stage.hero.setNextAction(next);
        }
        TUpdate();
        gameBuilder.Display();
        //heroTrans.transform.position  = new Vector2 (stage.hero.pos.x * dungeon.tileSize.x/100,stage.hero.pos.x * dungeon.tileSize.x/100);
    }
All Usage Examples Of IntVector2::Equals