void OnLevelWasLoaded() { if (m_controller == null) { m_controller = Game.controller; } }
//constructor, initlize the event handlers public SpaceWars() { InitializeComponent(); gc = new GController(); gc.RegisterTick(redraw); gc.RegisterKey(HandleKeyEvent); gc.RegisterStep(getStep); gc.RegisterResize(resize); panel = new DrawingPanel(gc.getWorld()); score = new ScorePanel(gc.getWorld()); gc.RegisterShip(score.addShips); gc.RegisterDie(score.DiedShips); panel.Location = new System.Drawing.Point(0, 40); panel.Size = new Size(750, 750); this.Size = new Size(1000, 835); panel.BackColor = Color.Black; this.Controls.Add(panel); isLeft = false; isRight = false; isThrust = false; isFire = false; }
protected virtual void Start() { m_controller = Game.controller; if (m_is_team_leader) { m_controller.GetTeam(m_team_id).SetLeader(this); } m_mobile = gameObject.AddComponent <GMobile>(); m_combatant = gameObject.AddComponent <GCombatant>(); m_actor = gameObject.AddComponent <GActor>(); m_health = new GameResource(m_max_health, 0, m_max_health); m_energy = new GameResource(100, 0, 100); m_player_control = gameObject.AddComponent <GPlayer>(); m_ai_control = gameObject.AddComponent <GEntityAI>(); m_appearance_root = transform.Find("Appearance").gameObject; m_mobile.SetFlip(m_appearance_root, true, false); m_combatant.FillDummyActions(); m_combatant.SetAction( "Attack", "A deadly attack.", new GActionTimer(ACTION.ATTACK, 0.5f, 0.25f, 0.25f, 1f, m_combatant.GenericActionStart, null), m_basic_attack_prefab, null, new ACTION_EFFECT[1] { ACTION_EFFECT.TELEPORT }, Resources.Load <Sprite>("Icons/ui_2x_laser_icon"), m_attack_range, m_attack_damage, true, true, true, true ); m_combatant.SetAction( "Block", "An impenetrable block.", new GActionTimer(ACTION.BLOCK, 0.1f, 0.1f, 0f, 1f, m_combatant.BlockActionStart, m_combatant.BlockActionEnd), m_basic_attack_prefab, null, new ACTION_EFFECT[0], Resources.Load <Sprite>("Icons/ui_2x_laser_icon"), 10, 10, true, true, true, true ); m_combatant.SetAction( "Single Shot", "Pew.", new GActionTimer(ACTION.SINGLE_SHOT, 0.1f, 0.1f, 0.2f, 1f, m_combatant.GenericActionStart, null), Resources.Load <GameObject>("Weapons/OLD/PlayerLaserSmall"), null, new ACTION_EFFECT[0], Resources.Load <Sprite>("Icons/ui_single_laser_icon"), 10, 10, true, true, true, true ); m_combatant.SetAction( "Double Shot", "Pew pew.", new GActionTimer(ACTION.DOUBLE_SHOT, 0f, 0f, 0.25f, 1f, m_combatant.GenericActionStart, null), Resources.Load <GameObject>("Weapons/PlayerDoubleLaser"), null, new ACTION_EFFECT[0], Resources.Load <Sprite>("Icons/ui_2x_laser_icon"), 10, 10, true, true, true, true ); }
private void Start() { gController = transform.parent.GetComponent <GController>(); }
// Start is called before the first frame update void Start() { script = controlador.GetComponent <GController>(); }