public override bool IsEnemy(BaseCharacterEntity characterEntity)
        {
            if (characterEntity == null)
            {
                return(false);
            }

            if (IsSummoned)
            {
                // If summoned by someone, will have same enemies with summoner
                return(characterEntity != Summoner && characterEntity.IsEnemy(Summoner));
            }
            // Attack only player by default
            return(characterEntity is BasePlayerCharacterEntity);
        }
示例#2
0
        private void Update()
        {
            if (characterEntity == null || BasePlayerCharacterController.OwningCharacter == null)
            {
                if (owningIndicator != null)
                {
                    owningIndicator.SetActive(false);
                }
                if (allyIndicator != null)
                {
                    allyIndicator.SetActive(false);
                }
                if (enemyIndicator != null)
                {
                    enemyIndicator.SetActive(false);
                }
                if (neutralIndicator != null)
                {
                    neutralIndicator.SetActive(false);
                }
                return;
            }

            if (Time.unscaledTime - lastUpdateTime >= updateRepeatRate)
            {
                lastUpdateTime = Time.unscaledTime;
                if (owningIndicator != null)
                {
                    owningIndicator.SetActive(false);
                }
                if (allyIndicator != null)
                {
                    allyIndicator.SetActive(false);
                }
                if (enemyIndicator != null)
                {
                    enemyIndicator.SetActive(false);
                }
                if (neutralIndicator != null)
                {
                    neutralIndicator.SetActive(false);
                }
                if (BasePlayerCharacterController.OwningCharacter == characterEntity)
                {
                    if (owningIndicator != null)
                    {
                        owningIndicator.SetActive(true);
                    }
                }
                if (characterEntity.IsAlly(BasePlayerCharacterController.OwningCharacter))
                {
                    if (allyIndicator != null)
                    {
                        allyIndicator.SetActive(true);
                    }
                }
                if (characterEntity.IsEnemy(BasePlayerCharacterController.OwningCharacter))
                {
                    if (enemyIndicator != null)
                    {
                        enemyIndicator.SetActive(true);
                    }
                }
                if (characterEntity.IsNeutral(BasePlayerCharacterController.OwningCharacter))
                {
                    if (neutralIndicator != null)
                    {
                        neutralIndicator.SetActive(true);
                    }
                }
            }
        }
示例#3
0
        private void Update()
        {
            if (characterEntity == null ||
                BasePlayerCharacterController.OwningCharacter == null ||
                Vector3.Distance(characterEntity.CacheTransform.position, BasePlayerCharacterController.OwningCharacter.CacheTransform.position) > updateWithinRange)
            {
                if (owningIndicator != null && owningIndicator.activeSelf)
                {
                    owningIndicator.SetActive(false);
                }
                if (allyIndicator != null && allyIndicator.activeSelf)
                {
                    allyIndicator.SetActive(false);
                }
                if (enemyIndicator != null && enemyIndicator.activeSelf)
                {
                    enemyIndicator.SetActive(false);
                }
                if (neutralIndicator != null && neutralIndicator.activeSelf)
                {
                    neutralIndicator.SetActive(false);
                }
                return;
            }

            if (Time.unscaledTime - lastUpdateTime >= updateRepeatRate)
            {
                lastUpdateTime = Time.unscaledTime;

                tempVisibleResult = BasePlayerCharacterController.OwningCharacter == characterEntity;
                if (owningIndicator != null && owningIndicator.activeSelf != tempVisibleResult)
                {
                    owningIndicator.SetActive(tempVisibleResult);
                }

                if (tempVisibleResult)
                {
                    return;
                }

                tempVisibleResult = characterEntity.IsAlly(BasePlayerCharacterController.OwningCharacter);
                if (allyIndicator != null && allyIndicator.activeSelf != tempVisibleResult)
                {
                    allyIndicator.SetActive(tempVisibleResult);
                }

                if (tempVisibleResult)
                {
                    return;
                }

                tempVisibleResult = characterEntity.IsEnemy(BasePlayerCharacterController.OwningCharacter);
                if (enemyIndicator != null && enemyIndicator.activeSelf != tempVisibleResult)
                {
                    enemyIndicator.SetActive(tempVisibleResult);
                }

                if (tempVisibleResult)
                {
                    return;
                }

                tempVisibleResult = characterEntity.IsNeutral(BasePlayerCharacterController.OwningCharacter);
                if (neutralIndicator != null && neutralIndicator.activeSelf != tempVisibleResult)
                {
                    neutralIndicator.SetActive(tempVisibleResult);
                }
            }
        }