public void AddTargetIndicator(GameObject target)
    {
        TargetIndicator indicator = GameObject.Instantiate(TargetIndicatorPrefab, canvas.transform).GetComponent <TargetIndicator>();

        indicator.InitialiseTargetIndicator(target, MainCamera, canvas);
        targetIndicators.Add(indicator);
    }
 private void Start()
 {
     targetTag       = GameObject.FindWithTag("Target");
     player          = GameObject.FindWithTag("Player");
     refillNeed      = player.GetComponent <Player_Needs>();
     targetIndicator = GetComponent <TargetIndicator>();
 }
示例#3
0
 // Update is called once per frame
 void Update()
 {
     if (isPicked)
     {
         transform.localScale = new Vector3(0.5f, 0.5f, 1);
         transform.position   = player.transform.position + new Vector3(index * 0.5f, 0.7f, 0);
         if (isNearExit())
         {
             //Destroy(this); distrug asta si sageata
             foreach (Transform child in controller.gameObject.transform)
             {
                 TargetIndicator tg = child.GetComponent <TargetIndicator>();
                 if (tg != null && tg.Target == this)
                 {
                     tg.gameObject.SetActive(false);
                     Destroy(tg.gameObject);
                 }
             }
             Destroy(gameObject);
         }
     }
     else
     {
         isNearPlayer();
     }
 }
    private void cleanPool()
    {
        while (_arrowIndicatorPool.Count > _arrowPoolUsedCount)
        {
            Image lastArrow = _arrowIndicatorPool[_arrowIndicatorPool.Count - 1];
            _arrowIndicatorPool.Remove(lastArrow);
            Destroy(lastArrow.gameObject);
        }

        while (_boxIndicatorPool.Count > _boxPoolUsedCount)
        {
            TargetIndicator lastBox = _boxIndicatorPool[_boxIndicatorPool.Count - 1];
            _boxIndicatorPool.Remove(lastBox);
            Destroy(lastBox.gameObject);
        }

        // Objective waypoint offscreen arrows
        while (_objectiveArrowPool.Count > _objectiveArrowPoolUsedCount)
        {
            Image lastArrow = _objectiveArrowPool[_objectiveArrowPool.Count - 1];
            _objectiveArrowPool.Remove(lastArrow);
            Destroy(lastArrow.gameObject);
        }

        // Objective waypoint onscreen indicator
        while (_objectiveIconPool.Count > _objectiveIconPoolUsedCount)
        {
            ObjectiveIndicator lastIcon = _objectiveIconPool[_objectiveIconPool.Count - 1];
            _objectiveIconPool.Remove(lastIcon);
            Destroy(lastIcon.gameObject);
        }
    }
示例#5
0
 private void HandleIndicatorSelected(TargetIndicator newIndicator)
 {
     if (selectedIndicator != null)
     {
         selectedIndicator.Deselect();
     }
     selectedIndicator = newIndicator;
 }
示例#6
0
 public void DeselectCurrentIndicator()
 {
     if (selectedIndicator != null)
     {
         selectedIndicator.Deselect();
     }
     selectedIndicator = null;
 }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     TargetIndicator targ = (TargetIndicator) target;
     EditorGUILayout.Vector3Field("TargetViewportPoint", targ.TargetViewportPoint);
     EditorGUILayout.Toggle("Is On Screen", targ.TargetIsOnScreen);
     EditorGUILayout.Toggle("In Range", targ.TargetIsInRange);
 }
 void Awake() {
     if (Instance == null) {
         Instance = this;
         sprite = GetComponent<SpriteRenderer>();
     }
     else {
         Destroy(gameObject);
     }
 }
示例#9
0
 // Start is called before the first frame update
 void Awake()
 {
     animator         = GetComponentInChildren <Animator>();
     state            = State.Idle;
     originalPosition = transform.position;
     originalRotation = transform.rotation;
     health           = GetComponent <Health>();
     targetIndicator  = GetComponentInChildren <TargetIndicator>();
 }
示例#10
0
 private void Start()
 {
     LandingPlatforms        = GetComponentsInChildren <PlatformController>();
     targetIndicator         = GetComponent <TargetIndicator>();
     targetIndicator.enabled = false;
     angle = Vector3.SignedAngle(Vector3.right, transform.position.normalized, Vector3.forward) * Mathf.Deg2Rad;
     GetComponent <Rigidbody>().mass *= GameController.Instance.Settings.PlanetMassScale;
     angle = GetInitialAngle();
 }
 void Start()
 {
     animator         = GetComponentInChildren <Animator>();
     playSound        = GetComponentInChildren <PlaySound>();
     state            = State.Idle;
     health           = GetComponent <Health>();
     targetIndicator  = GetComponentInChildren <TargetIndicator>(true);
     originalPosition = transform.position;
     originalRotation = transform.rotation;
 }
示例#12
0
    void Start()
    {
        target               = transform.position;
        agent                = GetComponent <NavMeshAgent>();
        mainCamera           = Camera.main;
        myTargetInst         = Instantiate(targetInst, transform.position, Quaternion.identity) as TargetIndicator;
        myTargetInst.enabled = false;

        regiment = GetComponent <Regiment>();
    }
示例#13
0
    public void LinkSearchArrow(int enemyNo, TargetIndicator targetIndicator, EnemySearch enemySearch, Transform canvasTran)
    {
        this.enemyNo = enemyNo;
        //this.searchArrow = searchArrow;

        this.enemySearch = enemySearch;

        this.targetIndicator = targetIndicator;

        targetIndicator.SetUpTarget(gameObject.transform, canvasTran);
    }
示例#14
0
    // TargetIndicatorの生成
    void BuildTargetIndicator(Transform target)
    {
        GameObject targetIndicator_clone = Instantiate(targetIndicator, new Vector3(0, 0, 0), Quaternion.identity);

        // canvas以下へ移動
        targetIndicator_clone.transform.SetParent(canvas.transform, false);
        // targetを指定
        TargetIndicator newTargetIndicator = targetIndicator_clone.GetComponent <TargetIndicator>();

        newTargetIndicator.target = target;
    }
示例#15
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     isActive = true;
     if (other.GetComponent <TargetIndicator>() != null)
     {
         other.transform.SetParent(this.transform);
         TargetIndicator ind = other.GetComponent <TargetIndicator>();
         if (ind.target == this.transform)
         {
             planetIndicator.GetComponent <SpriteRenderer>().color = activeColor;
             ind.isActive = true;
         }
         else
         {
             planetIndicator.GetComponent <SpriteRenderer>().color = nonActiveColor;
         }
     }
 }
示例#16
0
    // Start is called before the first frame update
    public virtual void Start()
    {
        playerTransform       = GameObject.FindGameObjectWithTag("Player").transform;
        playerCharacterAttack = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterAttack>();;
        agent           = GetComponent <NavMeshAgent>();
        rb              = GetComponent <Rigidbody>();
        enemy           = GetComponent <Enemy>();
        targetIndicator = FindObjectOfType <TargetIndicator>();

        enemyMaterial = new Material(enemy.enemyMaterial);
        enemyGraph.GetComponent <SkinnedMeshRenderer>().material = enemyMaterial;

        maxTimeRotateOneSide_ = maxTimeRotateOneSide;

        startPos = transform.position;

        enemyStates = EnemyStates.idle;
    }
示例#17
0
        public ActionResult <Grunt> CreateGrunt([FromBody] Grunt grunt)
        {
            TargetIndicator indicator = _context.Indicators.Where(I => I.Name == "TargetIndicator")
                                        .Select(T => (TargetIndicator)T)
                                        .FirstOrDefault(T => T.ComputerName == grunt.IPAddress && T.UserName == grunt.UserDomainName + "\\" + grunt.UserName);

            if (indicator == null && grunt.IPAddress != null && grunt.IPAddress != "")
            {
                _context.Indicators.Add(new TargetIndicator
                {
                    ComputerName = grunt.IPAddress,
                    UserName     = grunt.UserName,
                });
            }
            _context.Grunts.Add(grunt);
            _context.SaveChanges();
            return(CreatedAtRoute(nameof(GetGrunt), new { id = grunt.Id }, grunt));
        }
示例#18
0
    void setInstatiatePlayer()
    {
        if (loaded)
        {
            //For target indicator
            targetIndicator        = FindObjectOfType <TargetIndicator>();
            targetIndicator.target = dialogueObj[0].transform;
            targetIndicator.SetChildrenActive(false);

            //for Hotkey
            Hotkey    = FindObjectOfType <HotKey>();
            slotPanel = GameObject.Find("SlotPanel");

            for (int i = 0; i < 4; i++)
            {
                hotKeySlots[i] = slotPanel.transform.GetChild(i).gameObject;
            }

            loaded = false;
        }
    }
示例#19
0
 void Start()
 {
     ti = TargetIndicator.GetInstance;
 }
 private void Start()
 {
     targetIndicator = GetComponentInChildren <TargetIndicator>(true);
     entity.AddTargetIndicator(targetIndicator.gameObject);
     entity.AddAnimator(_animator);
 }
示例#21
0
        public async Task <IActionResult> CreateTargetIndicator(TargetIndicator indicator)
        {
            Indicator createdIndicator = await _context.CreateIndicator(indicator);

            return(RedirectToAction("Index", "Data"));
        }
    void LateUpdate()
    {
        resetPool();

        if (!GameManager.instance.IsMenuOpen)
        {
            // POSITION OBJECTIVE ARROWS AND INDICATORS
            Vector3[] waypoints = GameManager.questManager.GetActiveQuestObjectiveTargets();
            if (waypoints != null)
            {
                foreach (Vector3 waypoint in waypoints)
                {
                    Vector3 targetPosition = Camera.main.WorldToScreenPoint(waypoint);

                    // If the target is onscreen show the onscreen indicator
                    if (targetPosition.z > 0f && targetPosition.x >= 0f && targetPosition.x <= Screen.width && targetPosition.y >= 0f && targetPosition.y <= Screen.height)
                    {
                        if (targetPosition.z > 500f)
                        {
                            ObjectiveIndicator indicatorImage = getObjectiveIcon();
                            indicatorImage.GetComponent <RectTransform>().anchoredPosition = new Vector3(targetPosition.x, targetPosition.y, 0f);
                            indicatorImage.SetDistance(Vector3.Distance(waypoint, GameManager.playerTransform.position));
                        }
                    }
                    else
                    {
                        PositionArrowIndicator(targetPosition, ArrowType.waypoint);
                    }
                }
            }

            // POSITION ENEMY ARROWS AND BOXES
            var enemies = GameManager.instance.TargetableObjects.Where(t => t.Allegiance == Enums.Allegiance.Enemy);

            foreach (TargetableObject obj in enemies)
            {
                if (GameManager.playerTransform != null)
                {
                    if (Vector3.Distance(obj.transform.position, GameManager.playerTransform.position) < 500f)
                    {
                        Vector3 targetPosition = Camera.main.WorldToScreenPoint(obj.transform.position);

                        // If the target is onscreen show the onscreen indicator & health bar
                        if (targetPosition.z > 0f && targetPosition.x >= 0f && targetPosition.x <= Screen.width && targetPosition.y >= 0f && targetPosition.y <= Screen.height)
                        {
                            TargetIndicator box = getBoxIndicator();
                            box.anchoredPosition    = new Vector3(targetPosition.x, targetPosition.y, 0f);
                            box.healthBarFillAmount = (float)obj.GetComponent <HealthController>().Health / (float)obj.GetComponent <HealthController>().MaxHealth;

                            float multiplier   = (maxAlpha - minAlpha) / alphaThreshold;
                            float currentAlpha = maxAlpha;
                            box.healthBarVisible = false;
                            if (targetPosition.z < alphaThreshold)
                            {
                                box.healthBarVisible = true;
                                currentAlpha         = minAlpha + (targetPosition.z * multiplier);
                            }

                            box.boxAlpha = currentAlpha / 255f;

                            //Vector3 lead = CalculateLead(player.transform.position, obj.transform.position, projectileSpeed * 1.5f, obj.gameObject.GetComponent<Rigidbody>().velocity, player.GetComponent<Rigidbody>().velocity);
                            //box.trajectory.rectTransform.anchoredPosition = Camera.main.WorldToScreenPoint(lead) - screenCenter;
                        }
                        else // Offscreen - show directional arrow
                        {
                            if (waypoints == null || !OverlapsWaypoint(waypoints, obj.transform.position))
                            {
                                PositionArrowIndicator(targetPosition, ArrowType.enemy);
                            }
                        }
                    }
                }
            }


            // Warp target indicators
            _warpIndicatorInstance.gameObject.SetActive(false);
            if (GameManager.instance.IsCursorVisible)
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                int        layerMask = 1 << 2;
                layerMask = ~layerMask;
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
                {
                    WarpTarget target = hit.collider.gameObject.GetComponent <WarpTarget>();
                    if (target != null)
                    {
                        _warpIndicatorInstance.gameObject.SetActive(true);
                        _warpIndicatorInstance.SetDestinationName(target.TargetName);

                        // Works with sphere colliders
                        Vector3 centerPosition = Camera.main.WorldToScreenPoint(target.Bounds.center);
                        float   diffPosition   = Camera.main.WorldToScreenPoint(target.Bounds.max).y - centerPosition.y;
                        Vector3 topPosition    = centerPosition + new Vector3(0f, diffPosition * 0.8f, 0f);

                        _warpIndicatorInstance.SetNamePosition(topPosition);

                        // Disable entry point indicator if it is currently overlapping an objective marker
                        if (waypoints == null || !OverlapsWaypoint(waypoints, target.Position))
                        {
                            _warpIndicatorInstance.SetEntryPointPosition(target.Position);
                        }
                        else
                        {
                            _warpIndicatorInstance.DisableEntryPoint();
                        }
                    }
                }
            }
        }
        cleanPool();
    }
示例#23
0
        public ActionResult <Grunt> EditGrunt([FromBody] Grunt grunt)
        {
            var matching_grunt = _context.Grunts.FirstOrDefault(g => grunt.Id == g.Id);

            if (matching_grunt == null)
            {
                return(NotFound());
            }

            if (matching_grunt.Status == Grunt.GruntStatus.Active && grunt.Status == Grunt.GruntStatus.Active)
            {
                if (matching_grunt.Delay != grunt.Delay)
                {
                    _context.GruntTaskings.Add(new GruntTasking {
                        GruntId = grunt.Id,
                        type    = GruntTasking.GruntTaskingType.Set,
                        SetType = GruntTasking.GruntSetTaskingType.Delay,
                        Value   = grunt.Delay.ToString()
                    });
                }
                else if (matching_grunt.Jitter != grunt.Jitter)
                {
                    _context.GruntTaskings.Add(new GruntTasking
                    {
                        GruntId = grunt.Id,
                        type    = GruntTasking.GruntTaskingType.Set,
                        SetType = GruntTasking.GruntSetTaskingType.Jitter,
                        Value   = grunt.Jitter.ToString()
                    });
                }
                else if (matching_grunt.ConnectAttempts != grunt.ConnectAttempts)
                {
                    _context.GruntTaskings.Add(new GruntTasking
                    {
                        GruntId = grunt.Id,
                        type    = GruntTasking.GruntTaskingType.Set,
                        SetType = GruntTasking.GruntSetTaskingType.ConnectAttempts,
                        Value   = grunt.ConnectAttempts.ToString()
                    });
                }
            }
            matching_grunt.Name            = grunt.Name;
            matching_grunt.UserDomainName  = grunt.UserDomainName;
            matching_grunt.UserName        = grunt.UserName;
            matching_grunt.Status          = grunt.Status;
            matching_grunt.Integrity       = grunt.Integrity;
            matching_grunt.Process         = grunt.Process;
            matching_grunt.LastCheckIn     = grunt.LastCheckIn;
            matching_grunt.IPAddress       = grunt.IPAddress;
            matching_grunt.OperatingSystem = grunt.OperatingSystem;

            matching_grunt.ConnectAttempts = grunt.ConnectAttempts;
            matching_grunt.Delay           = grunt.Delay;
            matching_grunt.Jitter          = grunt.Jitter;

            matching_grunt.CovenantIPAddress      = grunt.CovenantIPAddress;
            matching_grunt.DotNetFrameworkVersion = grunt.DotNetFrameworkVersion;

            matching_grunt.GruntChallenge            = grunt.GruntChallenge;
            matching_grunt.GruntNegotiatedSessionKey = grunt.GruntNegotiatedSessionKey;
            matching_grunt.GruntRSAPublicKey         = grunt.GruntRSAPublicKey;
            matching_grunt.GruntSharedSecretPassword = grunt.GruntSharedSecretPassword;

            _context.Grunts.Update(matching_grunt);

            TargetIndicator indicator = _context.Indicators.Where(I => I.Name == "TargetIndicator")
                                        .Select(T => (TargetIndicator)T)
                                        .FirstOrDefault(T => T.ComputerName == matching_grunt.IPAddress && T.UserName == matching_grunt.UserDomainName + "\\" + matching_grunt.UserName);

            if (indicator == null && grunt.IPAddress != null && grunt.IPAddress != "")
            {
                _context.Indicators.Add(new TargetIndicator
                {
                    ComputerName = grunt.IPAddress,
                    UserName     = grunt.UserDomainName + "\\" + grunt.UserName
                });
            }
            _context.SaveChanges();

            return(Ok(matching_grunt));
        }
示例#24
0
        public ActionResult <Grunt> EditGrunt([FromBody] Grunt grunt)
        {
            var matching_grunt = _context.Grunts.FirstOrDefault(g => grunt.Id == g.Id);

            if (matching_grunt == null)
            {
                return(NotFound($"NotFound - Grunt with id: {grunt.Id}"));
            }

            if (matching_grunt.Status != Grunt.GruntStatus.Active && grunt.Status == Grunt.GruntStatus.Active)
            {
                grunt.ActivationTime = DateTime.UtcNow;
                _context.Events.Add(new Event
                {
                    Time          = DateTime.UtcNow,
                    MessageHeader = "[" + grunt.ActivationTime + " UTC] Grunt: " + grunt.Name + " from: " + grunt.Hostname + " has been activated!",
                    Level         = Event.EventLevel.Highlight,
                    Context       = "*"
                });
            }
            matching_grunt.Name = grunt.Name;
            matching_grunt.GUID = grunt.GUID;
            matching_grunt.OriginalServerGuid = grunt.OriginalServerGuid;
            matching_grunt.UserDomainName     = grunt.UserDomainName;
            matching_grunt.UserName           = grunt.UserName;
            matching_grunt.Status             = grunt.Status;
            matching_grunt.Integrity          = grunt.Integrity;
            matching_grunt.Process            = grunt.Process;
            matching_grunt.LastCheckIn        = grunt.LastCheckIn;
            matching_grunt.ActivationTime     = grunt.ActivationTime;
            matching_grunt.IPAddress          = grunt.IPAddress;
            matching_grunt.Hostname           = grunt.Hostname;
            matching_grunt.OperatingSystem    = grunt.OperatingSystem;

            matching_grunt.Children       = grunt.Children;
            matching_grunt.CommType       = grunt.CommType;
            matching_grunt.ValidateCert   = grunt.ValidateCert;
            matching_grunt.UseCertPinning = grunt.UseCertPinning;
            matching_grunt.SMBPipeName    = grunt.SMBPipeName;

            matching_grunt.ConnectAttempts = grunt.ConnectAttempts;
            matching_grunt.Delay           = grunt.Delay;
            matching_grunt.JitterPercent   = grunt.JitterPercent;
            matching_grunt.KillDate        = grunt.KillDate;

            matching_grunt.CovenantIPAddress      = grunt.CovenantIPAddress;
            matching_grunt.DotNetFrameworkVersion = grunt.DotNetFrameworkVersion;

            matching_grunt.GruntChallenge            = grunt.GruntChallenge;
            matching_grunt.GruntNegotiatedSessionKey = grunt.GruntNegotiatedSessionKey;
            matching_grunt.GruntRSAPublicKey         = grunt.GruntRSAPublicKey;
            matching_grunt.GruntSharedSecretPassword = grunt.GruntSharedSecretPassword;

            _context.Grunts.Update(matching_grunt);

            TargetIndicator indicator = _context.Indicators.Where(I => I.Name == "TargetIndicator")
                                        .Select(T => (TargetIndicator)T)
                                        .FirstOrDefault(T => T.ComputerName == grunt.Hostname && T.UserName == grunt.UserDomainName + "\\" + grunt.UserName);

            if (indicator == null && !string.IsNullOrWhiteSpace(grunt.Hostname))
            {
                _context.Indicators.Add(new TargetIndicator
                {
                    ComputerName = grunt.Hostname,
                    UserName     = grunt.UserDomainName + "\\" + grunt.UserName
                });
            }
            _context.SaveChanges();

            return(matching_grunt);
        }