Esempio n. 1
0
 void testAddListener(GameEventManager gameEventManager)
 {
     Debug.Log("Test Code");
     gameEventManager.AddListener(GameEventType.DownArrowHit, pressDown);
     gameEventManager.AddListener(GameEventType.UpArrowHit, pressUp);
     gameEventManager.AddListener(GameEventType.RightArrowHit, pressRight);
     gameEventManager.AddListener(GameEventType.LeftArrowHit, pressLeft);
     gameEventManager.AddListener(GameEventType.EscHit, pressEsc);
 }
Esempio n. 2
0
    private void Initialize()
    {
        eventManager = GameEventManager.Instance;
        eventManager.AddListener <FocusSelectedEvent>(OnFocusSelected);

        cameraTransform = transform;    // cache it! transform is actually GetComponent<Transform>()

        dummyTargetGO = GameObject.Find(MiscellaneousPhrases.DummyCameraTargetGameObject);
        if (dummyTargetGO == null)
        {
            dummyTargetGO = new GameObject(MiscellaneousPhrases.DummyCameraTargetGameObject);
        }
        PlaceDummyTargetAtUniverseEdgeInDirection(cameraTransform.forward);
        // Add the collider after placing the DummyTarget so the placement algorithm doesn't accidently find it already in front of the camera
        dummyTargetGO.AddComponent <SphereCollider>().enabled = true;
        dummyTargetGO.layer = (int)Layers.DummyTarget;

        IsResetOnFocusEnabled          = true;
        IsRollEnabled                  = true;
        IsScrollZoomOutOnCursorEnabled = true;

        // UNDONE initial camera position should be focused on the player's starting planet, no rotation
        // initialize to WorldSpace no rotation
        cameraTransform.rotation = Quaternion.identity;
        xRotation = Vector3.Angle(Vector3.right, cameraTransform.right);     // same as 0.0F
        yRotation = Vector3.Angle(Vector3.up, cameraTransform.up);           // same as 0.0F
        zRotation = Vector3.Angle(Vector3.forward, cameraTransform.forward); // same as 0.0F

        Debug.Log("Camera initialized. Camera Rotation = " + cameraTransform.rotation);
        focusTransform = null;

        ChangeState(CameraState.Freeform);
        isInitialized = true;
    }
Esempio n. 3
0
    private void Initialize()
    {
        eventManager = GameEventManager.Instance;
        eventManager.AddListener <FocusSelectedEvent>(OnFocusSelected);

        _transform    = transform; // cache it! transform is actually GetComponent<Transform>()
        dummyTargetGO = GameObject.Find(MiscellaneousPhrases.DummyCameraTargetGameObject);
        if (dummyTargetGO == null)
        {
            dummyTargetGO = new GameObject(MiscellaneousPhrases.DummyCameraTargetGameObject);
        }
        IsResetOnFocus = true;
        IsRollEnabled  = true;

        // TODO initial camera position should be focused on the player's starting planet, no rotation

        // initialize to WorldSpace no rotation
        _transform.rotation = Quaternion.identity;
        xRotation           = Vector3.Angle(Vector3.right, _transform.right);     // same as 0.0F
        yRotation           = Vector3.Angle(Vector3.up, _transform.up);           // same as 0.0F
        zRotation           = Vector3.Angle(Vector3.forward, _transform.forward); // same as 0.0F

        //Debug.Log("Camera initialized. Camera Rotation = " + _transform.rotation);
        focusTransform = null;

        Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0);

        TrySetNewFreeZoomTargetAt(screenCenter, 50F);   // UNDONE for now, create a temporary target just in front of the camera

        ChangeState(CameraState.Freeform);
        isInitialized = true;
    }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        gameObject.SetActive(activated);
        GameEventManager gameEventManager = EasyGetter.GetGameEventManager();

        gameEventManager.AddListener(GameEventType.EscHit, escHit);
    }
Esempio n. 5
0
    private void Initialize()
    {
        eventManager = GameEventManager.Instance;
        eventManager.AddListener <FocusSelectedEvent>(OnFocusSelected);

        _transform    = transform; // cache it as transform is actually GetComponent<Transform>()
        dummyTargetGO = GameObject.Find("Temp Camera Target");
        if (dummyTargetGO == null)
        {
            dummyTargetGO = new GameObject("Temp Camera Target");
        }
        IsResetOnFocus = true;
        IsRollEnabled  = true;

        // TODO initial camera position should be focused on the player's starting planet, no rotation
        cameraPosition = _transform.position;

        // initialize to WorldSpace no rotation
        cameraRotation      = Quaternion.identity;
        _transform.rotation = cameraRotation;
        xRotation           = Vector3.Angle(Vector3.right, _transform.right);     // same as 0.0F
        yRotation           = Vector3.Angle(Vector3.up, _transform.up);           // same as 0.0F
        zRotation           = Vector3.Angle(Vector3.forward, _transform.forward); // same as 0.0F

        Debug.Log("Camera initialized. Camera Rotation = " + cameraRotation);
        focusTransform = null;
        // for now, create a temporary target just in front of the camera
        Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0);

        SetTargetAtScreenPoint(screenCenter);
        ChangeState(CameraState.Freeform);
        isInitialized = true;
    }
Esempio n. 6
0
 /// <summary>
 /// Called when enabled set to true, including by Awake()
 /// </summary>
 void OnEnable()
 {
     Debug.Log("OnEnable() called. Enabled = " + enabled + ", isInitialized = " + isInitialized);
     if (isInitialized)
     {
         eventManager.AddListener <FocusSelectedEvent>(OnFocusSelected);
     }
 }
Esempio n. 7
0
 protected virtual void OnEnable()
 {
     GameEventManager.AddListener <GameEvent_OpenCatalogue>(OnCatalogueOpen);
     GameEventManager.AddListener <GameEvent_CloseCatalogue>(OnCatalogueClose);
     GameEventManager.AddListener <GameEvent_PageTurn>(OnPageTurned);
     GameEventManager.AddListener <ItemSoundOnDestroy>(OnItemDestroyedSound);
     GameEventManager.AddListener <BDItemDestroyed>(OnBDItemDestroyed);
 }
Esempio n. 8
0
 void OnEnable()
 {
     // called when enabled set to true, including by Awake()
     Debug.Log("OnEnable() called. Enabled = " + enabled);
     if (isInitialized)
     {
         eventManager.AddListener <FocusSelectedEvent>(OnFocusSelected);
     }
 }
Esempio n. 9
0
 public override void Awake()
 {
     GameEventManager.AddListener(this, GameEventManager.EventType.GameFlowDataStarted);
 }
Esempio n. 10
0
 public static void AddGameEventListening <GEvent>(this GameEventListener <GEvent> caller) where GEvent : struct
 {
     GameEventManager.AddListener <GEvent>(caller);
 }
Esempio n. 11
0
 private void OnEnable()
 {
     GameEventManager.AddListener <CocoonDestroyed>(OnCocoonDestroyed);
 }
Esempio n. 12
0
 public virtual void OnEnable()
 {
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
 }
Esempio n. 13
0
    // Start is called before the first frame update
    void Start()
    {
        GameEventManager gameEventManager = EasyGetter.GetGameEventManager();

        gameEventManager.AddListener(GameEventType.EscHit, escHit);
    }
 private void OnEnable()
 {
     GameEventManager.AddListener <GameEvent_OpenCatalogue>(OnCatalogueOpen);
     GameEventManager.AddListener <GameEvent_CloseCatalogue>(OnCatalogueClose);
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
 }
Esempio n. 15
0
    private void Initialize() {
        eventManager = GameEventManager.Instance;
        eventManager.AddListener<FocusSelectedEvent>(OnFocusSelected);

        _transform = transform;    // cache it! transform is actually GetComponent<Transform>()
        dummyTargetGO = GameObject.Find(MiscellaneousPhrases.DummyCameraTargetGameObject);
        if (dummyTargetGO == null) {
            dummyTargetGO = new GameObject(MiscellaneousPhrases.DummyCameraTargetGameObject);
        }
        IsResetOnFocus = true;
        IsRollEnabled = true;

        // TODO initial camera position should be focused on the player's starting planet, no rotation

        // initialize to WorldSpace no rotation
        _transform.rotation = Quaternion.identity;
        xRotation = Vector3.Angle(Vector3.right, _transform.right);  // same as 0.0F
        yRotation = Vector3.Angle(Vector3.up, _transform.up);    // same as 0.0F
        zRotation = Vector3.Angle(Vector3.forward, _transform.forward);  // same as 0.0F

        //Debug.Log("Camera initialized. Camera Rotation = " + _transform.rotation);
        focusTransform = null;

        Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0);
        TrySetNewFreeZoomTargetAt(screenCenter, 50F);   // UNDONE for now, create a temporary target just in front of the camera 

        ChangeState(CameraState.Freeform);
        isInitialized = true;
    }
Esempio n. 16
0
 protected virtual void OnEnable()
 {
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
     GameEventManager.AddListener <MoneyEarnedEvent>(OnMoneyEarnedEvent);
 }
Esempio n. 17
0
    private void Initialize() {
        eventManager = GameEventManager.Instance;
        eventManager.AddListener<FocusSelectedEvent>(OnFocusSelected);

        cameraTransform = transform;    // cache it! transform is actually GetComponent<Transform>()

        dummyTargetGO = GameObject.Find(MiscellaneousPhrases.DummyCameraTargetGameObject);
        if (dummyTargetGO == null) {
            dummyTargetGO = new GameObject(MiscellaneousPhrases.DummyCameraTargetGameObject);
        }
        PlaceDummyTargetAtUniverseEdgeInDirection(cameraTransform.forward);
        // Add the collider after placing the DummyTarget so the placement algorithm doesn't accidently find it already in front of the camera
        dummyTargetGO.AddComponent<SphereCollider>().enabled = true;
        dummyTargetGO.layer = (int)Layers.DummyTarget;

        IsResetOnFocusEnabled = true;
        IsRollEnabled = true;
        IsScrollZoomOutOnCursorEnabled = true;

        // UNDONE initial camera position should be focused on the player's starting planet, no rotation
        // initialize to WorldSpace no rotation
        cameraTransform.rotation = Quaternion.identity;
        xRotation = Vector3.Angle(Vector3.right, cameraTransform.right);  // same as 0.0F
        yRotation = Vector3.Angle(Vector3.up, cameraTransform.up);    // same as 0.0F
        zRotation = Vector3.Angle(Vector3.forward, cameraTransform.forward);  // same as 0.0F

        Debug.Log("Camera initialized. Camera Rotation = " + cameraTransform.rotation);
        focusTransform = null;

        ChangeState(CameraState.Freeform);
        isInitialized = true;
    }
Esempio n. 18
0
 private void OnEnable()
 {
     GameEventManager.AddListener <ItemHoverOver>(OnItemHoverOver);
     GameEventManager.AddListener <ItemHoverExit>(OnItemHoverExit);
 }
 private void OnEnable()
 {
     GameEventManager.AddListener <ItemThrown>(OnItemThrown);
 }
    private void Initialize() {
        eventManager = GameEventManager.Instance;
        eventManager.AddListener<FocusSelectedEvent>(OnFocusSelected);

        _transform = transform;    // cache it as transform is actually GetComponent<Transform>()
        dummyTargetGO = GameObject.Find("Temp Camera Target");
        if (dummyTargetGO == null) {
            dummyTargetGO = new GameObject("Temp Camera Target");
        }
        IsResetOnFocus = true;
        IsRollEnabled = true;

        // TODO initial camera position should be focused on the player's starting planet, no rotation
        cameraPosition = _transform.position;

        // initialize to WorldSpace no rotation
        cameraRotation = Quaternion.identity;
        _transform.rotation = cameraRotation;
        xRotation = Vector3.Angle(Vector3.right, _transform.right);  // same as 0.0F
        yRotation = Vector3.Angle(Vector3.up, _transform.up);    // same as 0.0F
        zRotation = Vector3.Angle(Vector3.forward, _transform.forward);  // same as 0.0F

        Debug.Log("Camera initialized. Camera Rotation = " + cameraRotation);
        focusTransform = null;
        // for now, create a temporary target just in front of the camera 
        Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0);
        SetTargetAtScreenPoint(screenCenter);
        ChangeState(CameraState.Freeform);
        isInitialized = true;
    }
Esempio n. 21
0
 private void OnEnable()
 {
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
 }