public bool collides(CGameObject aGameObject) { if (CMath.dist(getX(), getY(), aGameObject.getX(), aGameObject.getY()) < (getRadius() + aGameObject.getRadius())) { return(true); } else { return(false); } }
public override void setState(int aState) { base.setState(aState); if (getState() == STATE_WAITING) { setVisible(false); } else if (getState() == STATE_ACTING) { setVisible(true); setXY(entityCasting.getX() + posX, entityCasting.getY() + posY); } else if (getState() == STATE_ENDED) { setDead(true); setVisible(false); } }
public hitBox(CGameObject caster, int sizeX, int sizeY, int positionX, int positionY, int frameDelay, int duration, int team, bool recursivo = false, int cantDeRepeticiones = 0) { entityCasting = caster; width = sizeX; height = sizeY; setXY(caster.getX() + positionX, caster.getY() + positionY); delay = frameDelay; boxDuration = duration; if (recursivo) { boxRecursivo = recursivo; repeticiones = cantDeRepeticiones; } setImage(Resources.Load <Sprite>("Sprites/ui/pixel")); setSortingLayerName("Player"); setSortingOrder(20); setColor(Color.blue); setAlpha(0.5f); setName(caster + " hitBox"); posX = positionX; posY = positionY; setXY(-width, -height); setScaleX(sizeX); setScaleY(sizeY); if (delay == 0) { setState(STATE_ACTING); } else { setState(STATE_WAITING); } }