Ejemplo n.º 1
0
    //public void Target(BaseActor baseActor, bool isEnemy = false)
    //{
    //    TargetBaseActor = baseActor;
    //    TargetingEnemy = isEnemy;
    //    TargetedObject.SetActive(true);
    //    TargetObjectName.GetComponent<Text>().text = TargetBaseActor.name;


    //    if (isEnemy)
    //    {
    //        TargetObjectFill.GetComponent<Image>().color = Color.red;
    //        TargetedObjectHealth.GetComponent<Slider>().maxValue = TargetBaseActor.GetComponent<MobActor>().MaxHealth;
    //        TargetedObjectHealth.GetComponent<Slider>().value = TargetBaseActor.GetComponent<MobActor>().Health;
    //    }
    //    else
    //    {
    //        TargetObjectFill.GetComponent<Image>().color = Color.green;
    //        TargetedObjectHealth.GetComponent<Slider>().maxValue = 1;
    //        TargetedObjectHealth.GetComponent<Slider>().value = 1;
    //    }
    //}

    public void Target2(GameObject gameObject)
    {
        //CurrentlyTargeted = gameObject;
        TargetedObject.SetActive(true);
        TargetObjectName.GetComponent <Text>().text = TargetBaseActor.name;

        TargetObjectFill.GetComponent <Image>().color         = Color.red;
        TargetedObjectHealth.GetComponent <Slider>().maxValue = TargetBaseActor.GetComponent <MobActor>().MaxHealth;
        TargetedObjectHealth.GetComponent <Slider>().value    = TargetBaseActor.GetComponent <MobActor>().Health;
    }
Ejemplo n.º 2
0
        public override void Transform(BaseActor actor, Vector3?pos, Quaternion?rot, Vector3?scale)
        {
            TransformComponent transform = actor.GetComponent <TransformComponent>();

            if (transform != null)
            {
                if (pos != null)
                {
                    transform.Position = pos.Value;
                }
                if (rot != null)
                {
                    transform.Rotation = rot.Value;
                }
                if (scale != null)
                {
                    transform.Scale = scale.Value;
                }
            }

            RenderComponent renderComponent = transform.Sibling <RenderComponent>();//actor.GetComponent<RenderComponent>();
            //if(renderComponent != null)
            {
                SyncRenderComponent(renderComponent, transform);
            }
            //TODO:
            //UnityActor unityActor = (UnityActor)actor;
            //unityActor.SyncUnityPos();
        }
Ejemplo n.º 3
0
    public virtual void Damage(GameObject attackedObject, float amount)
    {
        // Make minimum unit of hp to 0.5
        amount = Mathf.FloorToInt(amount * 2) / 2f;
        hp     = Mathf.Max(hp - amount, 0f);

        bool willDead = (hp <= 0);

        if (willDead)
        {
            if (!actor.isDead)
            {
                actor.GetComponent <Damageable>().Die(attackedObject);
            }
        }
        else
        {
            actor.EventDamaged();
        }
    }