public override void _Ready() { base._Ready(); dynamicCameraSingleton = (DynamicCameraSingleton)GetNode("/root/DynamicCameraSingleton"); dynamicCameraSingleton.SetHalfScreenSize(GetViewportRect().Size * 0.5f); }
// logic // public override void _Ready() { if (Engine.EditorHint) { return; } base._Ready(); dynamicCameraSingleton = (DynamicCameraSingleton)GetNode("/root/DynamicCameraSingleton"); consoleSingleton = GetNode <DebugConsole>("/root/DebugConsole"); animatedSprite = GetNode <AnimatedSprite>("CharacterSprite"); attackArea = GetNode <Area2D>("AttackArea"); swordSlashAnimation = GetNode <AnimatedSprite>("AttackArea/SwordSlashAnimation"); globalState = GetNode <GlobalState>("/root/GlobalState"); animatedSprite.Play("idle"); health = maxHealth; Node possibleInGameUi = GetNode(inGameUiPath); if (possibleInGameUi is InGameUi) { inGameUi = (InGameUi)possibleInGameUi; } meleeCooldownProgress = meleeCooldown; consoleSingleton.RegisterCommand("godmode", "Disable all player damage", OnGodmode); }
public override void _Ready() { base._Ready(); CollisionShape2D areaShape = GetNode <CollisionShape2D>("AreaShape"); Vector2 areaShapeExtents = ((RectangleShape2D)areaShape.Shape).Extents; Vector2 areaShapeOrigin = areaShape.Position; area = new Rect2( areaShapeOrigin - areaShapeExtents, 2.0f * areaShapeExtents ); DynamicCameraSingleton dynamicCameraSingleton = (DynamicCameraSingleton)GetNode("/root/DynamicCameraSingleton"); dynamicCameraSingleton.SetCameraArea(area); }