コード例 #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);
 }
コード例 #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;
    }
コード例 #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;
    }
コード例 #4
0
    // Start is called before the first frame update
    void Start()
    {
        gameObject.SetActive(activated);
        GameEventManager gameEventManager = EasyGetter.GetGameEventManager();

        gameEventManager.AddListener(GameEventType.EscHit, escHit);
    }
コード例 #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;
    }
コード例 #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);
     }
 }
コード例 #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);
 }
コード例 #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);
     }
 }
コード例 #9
0
ファイル: ThinCover.cs プロジェクト: jacko12549/EvoS
 public override void Awake()
 {
     GameEventManager.AddListener(this, GameEventManager.EventType.GameFlowDataStarted);
 }
コード例 #10
0
 public static void AddGameEventListening <GEvent>(this GameEventListener <GEvent> caller) where GEvent : struct
 {
     GameEventManager.AddListener <GEvent>(caller);
 }
コード例 #11
0
 private void OnEnable()
 {
     GameEventManager.AddListener <CocoonDestroyed>(OnCocoonDestroyed);
 }
コード例 #12
0
 public virtual void OnEnable()
 {
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
 }
コード例 #13
0
    // Start is called before the first frame update
    void Start()
    {
        GameEventManager gameEventManager = EasyGetter.GetGameEventManager();

        gameEventManager.AddListener(GameEventType.EscHit, escHit);
    }
コード例 #14
0
 private void OnEnable()
 {
     GameEventManager.AddListener <GameEvent_OpenCatalogue>(OnCatalogueOpen);
     GameEventManager.AddListener <GameEvent_CloseCatalogue>(OnCatalogueClose);
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
 }
コード例 #15
0
ファイル: CameraController.cs プロジェクト: Maxii/POC.ToUnity
    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;
    }
コード例 #16
0
 protected virtual void OnEnable()
 {
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
     GameEventManager.AddListener <MoneyEarnedEvent>(OnMoneyEarnedEvent);
 }
コード例 #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;
    }
コード例 #18
0
 private void OnEnable()
 {
     GameEventManager.AddListener <ItemHoverOver>(OnItemHoverOver);
     GameEventManager.AddListener <ItemHoverExit>(OnItemHoverExit);
 }
コード例 #19
0
 private void OnEnable()
 {
     GameEventManager.AddListener <ItemThrown>(OnItemThrown);
 }
コード例 #20
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;
    }
コード例 #21
0
 private void OnEnable()
 {
     GameEventManager.AddListener <ItemBoughtEvent>(OnItemBoughtEvent);
 }