internal void Initialize(IAssetDispenser assetDispenser, ICommandSource commandSource,
                          IScreenBoundsSchecker bounds, ISessionEventsListener eventListener)
 {
     this.commandSource = commandSource;
     this.eventListener = eventListener;
     gun.Initialize(assetDispenser, bounds, eventListener);
     this.visualsRequest.RequestLoad(assetDispenser);
 }
Beispiel #2
0
    public void Initialize(EnemyTypeDefinition typeDef, Vector2 pos)
    {
        TypeDefinition = typeDef;
        gameObject.transform.position = pos;

        gameObject.GetComponent <SpriteRenderer>().sprite = TypeDefinition.Sprite;

        Health = TypeDefinition.StartingHealth;

        LauncherTypeDefinition = ProjectileLauncherFactory.GetLauncherTypeDefinition(typeDef.LauncherType);
        myLauncher             = gameObject.GetComponentInChildren <ProjectileLauncher>();
        myLauncher.Initialize(LauncherTypeDefinition, Vector2.down);

        canMoveAndShoot = false;
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        inputController = GameController.GetController <InputController>();

        rigidBody = GetComponent <Rigidbody2D>();

        projectileLauncher = GetComponentInChildren <ProjectileLauncher>();
        projectileLauncher.Initialize(ProjectileLauncherFactory.GetLauncherTypeDefinition(startingLauncher), Vector2.up);
        GetComponent <SpriteRenderer>().sprite = greenSprite;

        inputController.AddKeyCodeListener(KeyCode.Space, OnFire);

        SetHealth(maxHealth);         //hard coded full health (because that's how many health bars with in the UI)
        SetLives(maxLives);
    }