protected Entity SetMouseInput(float2 position) { var mousePosition = new MouseWorldPosition() { Position = position, Delta = float2.zero }; var tileUnderMouse = new TileUnderMouse(); var entity = _entityManager.CreateEntity(mousePosition.GetType(), tileUnderMouse.GetType()); _entityManager.SetComponentData(entity, mousePosition); _entityManager.SetComponentData(entity, tileUnderMouse); return(entity); }
// Use this for initialization void Start() { setSlot(1,1); nextSlotPosition++; if (allMonkeys == null) allMonkeys = new ArrayList(); if (boxYposition == null) boxYposition = new ArrayList(); if (yDirection == null) yDirection = new ArrayList(); playerScript = GameObject.Find("Player").GetComponent<CPlayer>(); mainScript = GameObject.Find("Codigo").GetComponent<MainScript>(); eventosMenu = GameObject.Find("Codigo").GetComponent<EventosMenu>(); mouseWorld = GameObject.Find("Codigo").GetComponent<MouseWorldPosition>(); boxYmax = 600; boxYmin = 670; xDirection = 0; allRects = new ArrayList(); }
private void OnPointDrag(MarkupPoint point) { var normal = point.Enter.CornerDir.Turn90(true); Line2.Intersect(point.Position.XZ(), (point.Position + point.Enter.CornerDir).XZ(), MouseWorldPosition.XZ(), (MouseWorldPosition + normal).XZ(), out float offsetChange, out _); point.Offset = (point.Offset + offsetChange * Mathf.Sin(point.Enter.CornerAndNormalAngle)).RoundToNearest(0.01f); }
/* * =========================================================================================================== * UNITY'S STUFF * =========================================================================================================== */ /// <summary> /// Executed when the script is loaded /// </summary> void Awake() { Script = this; myCam = gameObject.GetComponent<Camera>(); Transform tCodigo = GameObject.Find("Codigo").transform; inputStuffScript = tCodigo.gameObject.GetComponent<MouseWorldPosition>(); if(inputStuffScript == null) { // DEBUG Debug.LogError("Cannot find the input script"); } if(micListener == null) { // DEBUG Debug.LogError("Cannot find the 'microphone' object. Set it in the inspector."); } mainScript = tCodigo.gameObject.GetComponent<MainScript>(); }
/// <summary> /// Attack a target. Actually, 'attack' could be replaced by 'perform some action on...', because we using /// this function also to repair buildings, capture rocket parts, etc. /// </summary> /// <param name="transTarget"> Transform of the targeted object </param> /// <param name="currentMouseState"> A enum with the mouse state when the player issued an order </param> /// <summary> /// Performs the 'attack' of the monkey /// </summary> public void PerformAction(Transform transTarget, MouseWorldPosition.eMouseStates currentMouseState) { this.transTarget = transTarget; mouseState = currentMouseState; // DEBUG Debug.LogWarning(this.transform + " performing " + mouseState); // Go into pursuit mode -> walk to the target. When it is in range, perform the action EnterNewState(FSMState.STATE_PURSUIT); }
// Use this for initialization void Start() { bottomMenu = GetComponent<GUIBottomMenu>(); if(!bottomMenu) { // DEBUG Debug.LogError("Bottom menu object not found!"); } player = playerObject.GetComponent<CPlayer>(); if(!player) { // DEBUG Debug.LogError("Player object not found!"); } fTaxaConsumoOxigenio = 1.0f; fTaxaExtract = 1.0f; fTaxaFabrica = 1.0f; GetCurrentUnitsInScene(); mouseInputScript = gameObject.GetComponent<MouseWorldPosition>(); if(!mouseInputScript) { // DEBUG Debug.LogError("Cannot find the MouseWorldPosition component. Please check."); } questManager = gameObject.GetComponent<QuestManager>(); if(!questManager) { // DEBUG Debug.LogError("Cannot find the QuestManager component. Please check."); } //Instantiate(GameObject.("Monkey"), new Vector3(79.07609f,33.39249f,13.41692f), Quaternion.identity); // Get all the monkeys in the scene and assign their objects to some variables, so we have shortcuts to them GetMonkeysObjects(); }