Example #1
0
 public Message(string Speaker, string Content, LookType Look)
 {
     DataType     = Type.Message;
     this.speaker = Speaker;
     this.content = Content;
     this.look    = Look;
 }
Example #2
0
 public void SetDesiredLookAngle(float angle)
 {
     LookType = LookType.angle;
     LookTowardsAngleTarget = angle;
     Debug.Log("here?");
     IsIdle = false;
 }
Example #3
0
    public void SetEntity(Entity entity)
    {
        LookType = LookType.none;
        EventManager.Instance.AddListener(this);

        Entity           = entity;
        AnimationManager = GetComponent <LoadedEntityAnimationManager>();

        transform.position = new Vector3(entity.Position.x, transform.position.y, entity.Position.z);
        RigidBody          = GetComponent <Rigidbody>();
        Collider           = GetComponent <CapsuleCollider>();

        //Initiate the health bar for this entity
        GameObject entityhealthBar = Instantiate(ResourceManager.GetEntityGameObject("healthbar"));

        entityhealthBar.transform.parent        = transform;
        entityhealthBar.transform.localPosition = new Vector3(0, 2, 0);
        EntityHealthBar = entityhealthBar.GetComponentInChildren <EntityHealthBar>();

        DETAILS = (entity is NPC) ? (entity as NPC).EntityRelationshipManager.Personality.ToString() : "";

        GROUND_LAYER_MASK = LayerMask.GetMask("Ground");

        if (!(entity is Player))
        {
            IsPlayer = false;

            LEPathFinder = gameObject.AddComponent <LEPathFinder>();
            // Destroy(gameObject.GetComponent<Rigidbody>());

            GameObject speechBubble = Instantiate(ResourceManager.GetEntityGameObject("speechbubble"));
            speechBubble.transform.SetParent(transform);
            speechBubble.transform.localPosition = Vector3.zero;
            SpeechBubble = speechBubble.GetComponent <EntitySpeechBubble>();
            //SpeechBubble.SetText("this is a test", 5);
        }
        else
        {
            IsPlayer = true;
        }


        float speed = IsRunning ? Entity.MovementData.RunSpeed : Entity.MovementData.WalkSpeed;

        LEPathFinder?.SetSpeed(speed);
        LastTickPosition = entity.Position;
    }
        public override void DrawInspectorGUI()
        {
            cam = (Camera)UnityEditor.EditorGUILayout.ObjectField(new GUIContent("Camera",
                                                                                 "The camera that will be used for the condition. By default this is the main camera"), cam, typeof(Camera), true);

            cameraConditionType = (LookType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Condition Type",
                                                                                                 "The type of condition you want. The Looking At condition only passes when the user can see a specific transform or gameobject. The Looking Away condition only passes when a transform or gameobject is out of the users camera frustum."), cameraConditionType);

            conditionObject = (GameObject)UnityEditor.EditorGUILayout.ObjectField(new GUIContent("Target Object",
                                                                                                 "This is the object that the condition is based upon."), conditionObject, typeof(GameObject), true);

            componentParameter = (CameraConditionComponentParameters)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Component Parameter",
                                                                                                                          "The type of component the condition will be checked against.  Either transform (a single point in space), minimum box collider (any part of a box collider), full box collider (the entire box collider) or mesh renderer (any part of a mesh). For example with the Looking At condition and Minimum Box Collider, if any part of the box collider were to enter the camera's view, the condition would be met."), componentParameter);

            if (cameraConditionType == LookType.LookingAt && componentParameter != CameraConditionComponentParameters.MeshRenderer)
            {
                raycastIntensity = (RaycastIntensity)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Raycast Intesity",
                                                                                                          "When using the Looking At condition type raycasts are fired to make sure nothing is blocking the cameras line of sight to the object. Here you can customise how those raycasts should be fired. Ignore obstacles fires no raycasts and mean the condition will pass even if there is an object in the way. Very low does raycast checks at a maximum of once per second against the objects position. Low does raycast checks at a maximum of once per 0.1 secs against the objects position. Med does raycast checks once per frame against the objects position. High does raycast checks once per frame against every corner of the box collider."), raycastIntensity);
            }

            minDistance = UnityEditor.EditorGUILayout.FloatField(new GUIContent("Min Distance",
                                                                                "This field allows you to set a minimum distance between the selected camera and target object before the condition gets checked."), minDistance);
        }
 public void Edit(LookType lookType)
 {
     this._dBContext.Attach(lookType);
     this._dBContext.Entry(lookType).State = EntityState.Modified;
 }
 public void Add(LookType lookType)
 {
     lookType.UpdateDate = DateTime.Now;
     this._dBContext.Add(lookType);
 }
Example #7
0
 public override string ToString()
 {
     return("LookType: " + LookType.ToString());
 }
    /// <summary>
    /// 由player调用
    /// </summary>
    /// <param name="point"></param>
    /// <param name="playerLookType"></param>
    public void BeDrag(Vector3 point, LookType playerLookType)
    {
        if (playerLookType != this.lookType)
        {
            return;
        }

        //把鼠标滑动的向量转换到父物体的坐标系
        //Vector3 delta = Camera.main.ScreenToWorldPoint(Input.mousePosition + new Vector3(0, 0, puzzleController.CameraPos.localPosition.y));
        Vector3 delta = point - beginPoint;

        delta = puzzleController.transform.InverseTransformDirection(delta);
        Debug.Log(delta);
        delta = new Vector3(delta.x / puzzleController.transform.lossyScale.x, 0, delta.z / puzzleController.transform.lossyScale.z);



        //拖动
        Vector3    willLocalPos      = new Vector3();
        Vector2Int willArrayPosCeil  = new Vector2Int();
        Vector2Int willArrayPosFloor = new Vector2Int();

        switch (barType)
        {
        case HuarongBarType.Vertical2:
            willLocalPos      = beginLocalPos + new Vector3(0, 0, delta.z);
            willArrayPosCeil  = new Vector2Int(arrayPos.x, Mathf.CeilToInt(willLocalPos.z));
            willArrayPosFloor = new Vector2Int(arrayPos.x, Mathf.FloorToInt(willLocalPos.z));
            break;

        case HuarongBarType.vertical3:
            willLocalPos      = beginLocalPos + new Vector3(0, 0, delta.z);
            willArrayPosCeil  = new Vector2Int(arrayPos.x, Mathf.CeilToInt(willLocalPos.z));
            willArrayPosFloor = new Vector2Int(arrayPos.x, Mathf.FloorToInt(willLocalPos.z));
            break;

        case HuarongBarType.Horizonal2:
            willLocalPos      = beginLocalPos + new Vector3(delta.x, 0, 0);
            willArrayPosCeil  = new Vector2Int(Mathf.CeilToInt(willLocalPos.x), arrayPos.y);
            willArrayPosFloor = new Vector2Int(Mathf.FloorToInt(willLocalPos.x), arrayPos.y);
            break;

        case HuarongBarType.PlayerHorizonal2:
            willLocalPos      = beginLocalPos + new Vector3(delta.x, 0, 0);
            willArrayPosCeil  = new Vector2Int(Mathf.CeilToInt(willLocalPos.x), arrayPos.y);
            willArrayPosFloor = new Vector2Int(Mathf.FloorToInt(willLocalPos.x), arrayPos.y);
            break;

        default:
            break;
        }

        bool judgeCeil  = true;
        bool judgeFloor = true;

        //判断正方向位移碰撞
        List <Vector2Int> posList = SelfArrayPos(willArrayPosCeil);

        for (int i = 0; i < posList.Count; i++)
        {
            judgeCeil = judgeCeil && puzzleController.IsPosAvailable(posList[i]);
        }
        //判断负方向位移碰撞
        posList = SelfArrayPos(willArrayPosFloor);
        for (int i = 0; i < posList.Count; i++)
        {
            judgeFloor = judgeFloor && puzzleController.IsPosAvailable(posList[i]);
        }

        //如果正方向碰壁负方向没有 则直接到负方向整数
        if (!judgeCeil && judgeFloor)
        {
            transform.localPosition = new Vector3(willArrayPosFloor.x, transform.localPosition.y, willArrayPosFloor.y);
        }

        if (!judgeFloor && judgeCeil)
        {
            transform.localPosition = new Vector3(willArrayPosCeil.x, transform.localPosition.y, willArrayPosCeil.y);
        }

        //都没有碰撞的话就可以说明玩家指定的willpos是可以使用的
        if (judgeFloor && judgeCeil)
        {
            transform.localPosition = willLocalPos;
        }
    }
Example #9
0
 public void LookTowardsEntity(Entity entity)
 {
     LookType = LookType.entity;
     LookTowardsEntityTarget = entity;
 }
Example #10
0
 public void SetLookBasedOnMovement(bool onMovement)
 {
     LookType = LookType.direction;
     IsIdle   = false;
 }
Example #11
0
 public void LookTowardsPoint(Vector2 v)
 {
     IsIdle = false;
     LookTowardsPointTarget = new Vector3(v.x, 0, v.y);
     LookType = LookType.point;
 }
Example #12
0
 /// <summary>
 /// Causes entity to look towards the specified point
 /// </summary>
 /// <param name="v">Point of interest to face towards</param>
 public void LookTowardsPoint(Vector3 v)
 {
     IsIdle = false;
     LookTowardsPointTarget = v;
     LookType = LookType.point;
 }