public void Initialise()
    {
        myActions = this.GetComponents <PlayerAction> ();
        if (this.GetComponent <SpriteRenderer> () == true)
        {
            sr = this.GetComponent <SpriteRenderer> ();
        }

        if (sr == null)
        {
            sr = this.gameObject.GetComponentInChildren <SpriteRenderer> ();
        }
        if (sr == null)
        {
            Destroy(this);
        }
        else
        {
            sr.material = CommonObjectsStore.me.spriteOutline;
            so          = this.gameObject.AddComponent <SpriteOutline> ();
            so.sr       = sr;
            so.color    = CommonObjectsStore.me.spriteOutlineColor;
            so.getChildRenderers();
            so.outlineSize = 1;
            so.enabled     = false;
            initialised    = true;
        }
    }
Beispiel #2
0
    public void smashWindow()
    {
        smashed         = true;
        sr.sprite       = smashedSprite;
        sr.color        = new Color(1, 1, 1, 1);
        sr.sortingOrder = 1;
        //if (counter == openAnimation.Length - 1) {
        this.gameObject.GetComponent <Collider2D> ().enabled = false;
        //}
        this.gameObject.GetComponent <AudioController> ().playSound(SFXDatabase.me.smashGlass);

        foreach (GameObject g in NPCManager.me.npcsInWorld)
        {
            if (g == null)
            {
                continue;
            }
            NPCController npc = g.GetComponent <NPCController> ();
            npc.setHearedGunshot(this.transform.position, 14.0f);
        }
        PoliceController.me.setNoiseHeard(this.transform.position, 14.0f);


        PlayerAction pa = this.gameObject.GetComponent <PlayerAction> ();

        Destroy(pa);
        HighlightObjectWithPlayerActions h = this.gameObject.GetComponent <HighlightObjectWithPlayerActions> ();

        Destroy(h);
        SpriteOutline s = this.gameObject.GetComponent <SpriteOutline> ();

        Destroy(s);
    }
Beispiel #3
0
    private void Awake()
    {
        m_navMeshAgent = GetComponent <NavMeshAgent> ();
        m_navMeshAgent.updateRotation = false;

        m_spriteOutline = GetComponent <SpriteOutline> ();
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        time = (TimeManager)FindObjectOfType(typeof(TimeManager)); //Set Time manager
        foreach (Transform child in transform)
        {
            if (child.CompareTag("Renderer"))
            {
                bodyRenderTransform = child;
            }
        }
        //Set bodyRender equal to the transform of the proper childObject

        harmQuant     = 0f;
        harmThreshold = 1f;

        hinderQuant     = 0f;
        hinderThreshold = 1f;

        currMoveAct = new HaltAction("Halt", 0, this);
        currAct     = new Action("Open", 0, this);
        AddAffecter(new ResistanceAggregate(this, 0f));

        mind        = new Inanimate(null, this);
        interacting = false;
        outline     = GetComponent <SpriteOutline>();
        inventory   = new List <Item> {
            new Sword(this, 1)
        };
        CreateItemPackage(inventory, "RChest", 5.5f);
    }
 // Start is called before the first frame update
 void Start()
 {
     outline   = GetComponent <SpriteOutline>();
     buyPrice  = initialCost;
     sellPrice = buyPrice / 2;
     //fireRange.radius = rangeRadius;
 }
Beispiel #6
0
    //adds a box collider to make things draggable if they aren't already
    void Start()
    {
        if (gameObject.GetComponent <BoxCollider2D>() == null)
        {
            gameObject.AddComponent <BoxCollider2D>();
        }

        if (this.snapOnStart && toSnapTo != null)
        {
            this.target       = this.gameObject;
            this.targetScript = target.GetComponent <DragObject>();
            SnapTo(toSnapTo);
        }

        //if it's not nested, the move target is this
        if (transform.parent != null &&
            transform.parent.gameObject.GetComponent <DragObject>() != null)
        {
            target = gameObject.transform.parent.transform.gameObject;
        }
        else
        {
            target = gameObject;
        }

        //deactivate the outline shader
        outline = GetComponent <SpriteOutline>();
        if (outline == null)
        {
            outline = gameObject.AddComponent <SpriteOutline>();
        }
        outline.enabled = false;
        outline.color   = new Color(0x00, 0x41, 0xFF, 0xFF); //blue
    }
Beispiel #7
0
    //상호작용 객체(배열)들과 플레이어 객체 사이의 거리에 따른 UI변경 메소드
    public void btwPlayerAndkill(Vector3 posPlayer, List <GameObject> kills)
    {
        if (kills.Count != 0)
        {
            Vector3 poskill;
            distances = new double[kills.Count];
            for (int i = 0; i < kills.Count; i++)
            {
                poskill      = kills[i].transform.position;
                distances[i] = calcDistance(posPlayer, poskill);
                if (distances[i] > 5f)
                {
                    //오브젝트 태두리 설정
                    killBorder         = kills[i].GetComponent <SpriteOutline>();
                    killBorder.enabled = false;
                }
                else
                {
                    //오브젝트 태두리 설정
                    killBorder         = kills[i].GetComponent <SpriteOutline>();
                    killBorder.enabled = true;
                }
            }
            nearbyObject = kills[0];
            min          = distances[0];
            for (int i = 0; i < distances.Length; i++)
            {
                if (min > distances[i])
                {
                    nearbyObject = kills[i];
                    min          = distances[i];
                }
            }
            if (min < 5.0f)
            {
                KillObject paramObject = nearbyObject.gameObject.GetComponent <Kill_InteractObject>().killObject;

                GameObject killobject = GameObject.Find(paramObject.objectName);

                if (paramObject.IsPlayerAlive)
                {
                    if (killButton.onClick != null)
                    {
                        killButton.onClick.RemoveAllListeners();
                    }
                    killButton.onClick.AddListener(() => Use_kill(killobject, paramObject));
                }
                ChangeButtonUI(true);
            }
            else
            {
                ChangeButtonUI(false);
            }
        }
        else
        {
            //게임 종료
        }
    }
Beispiel #8
0
 void Start()
 {
     // get a reference of all the needed components
     audioSource    = GetComponent <AudioSource>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <Animator>();
     spriteOutline  = GetComponent <SpriteOutline>();
 }
Beispiel #9
0
 void Start()
 {
     rb        = GetComponent <Rigidbody2D>();
     outline   = GetComponent <SpriteOutline>();
     renderer  = GetComponent <SpriteRenderer>();
     initMouse = Input.mousePosition;
     mantisEnergySlider.maxValue = maxMantisEnergy;
 }
Beispiel #10
0
 void ShowOutline()
 {
     if (outline == null)
     {
         outline = CreateOutline(gameObject, true);
     }
     outline.gameObject.SetActive(true);
 }
Beispiel #11
0
    // Use this for initialization
    void Start()
    {
        outline        = gameObject.GetComponent <SpriteOutline>();
        ownerCol       = Color.white;
        circleMat      = sRend.material;
        territoryColor = gameObject.GetComponent <SpriteRenderer>().color;

        currentLines = new GameObject[adjacentNodes.Length];
    }
    protected void Awake()
    {
        anim    = GetComponentInChildren <SpriteAnimator>();
        outline = anim.GetComponent <SpriteOutline>();
        shadow  = transform.Find("Shadow") != null?transform.Find("Shadow").GetComponent <SpriteRenderer>() : null;

        AnimationEventManager.OnDamageTaken += Damage;
        AnimationEventManager.OnDeath       += Death;
    }
Beispiel #13
0
 void Awake()
 {
     outline      = GetComponent <SpriteOutline>();
     facingSprite = transform.GetChild(0).GetComponent <SpriteRenderer>();
     if (facing == Facing.Left)
     {
         facingSprite.flipX = !facingSprite.flipX;
     }
 }
    public void Start()
    {
        rb = GetComponent <Rigidbody2D>();

        if (spriteOutline == null)
        {
            spriteOutline = GetComponent <SpriteOutline>();
        }
    }
Beispiel #15
0
        private void AddSprite(Sprite sprite)
        {
            Sprites.Add(sprite);
            IOutline newOutline = new SpriteOutline(Origin, sprite, Color.Orange);

            Outlines.Add(newOutline);
            Owner.Events.InvokeEvent(new BeginOverlay(newOutline));
            Renderable.OrderSprites(Sprites);
        }
Beispiel #16
0
    void Awake()
    {
        m_collider        = GetComponent <Collider2D>();
        m_text            = GetComponentInChildren <TextMesh>();
        m_outline         = GetComponent <SpriteOutline>();
        m_outline.enabled = false;
        m_text.gameObject.SetActive(false);

        SelectableManagerLogic.add(this);
    }
Beispiel #17
0
 //Internals
 protected void Start()
 {
     selected    = false;
     sr          = GetComponent <SpriteRenderer>();
     sr.material = Resources.Load("Materials/PixelPerfectOutline") as Material;
     sprout      = gameObject.AddComponent <SpriteOutline>();
     col         = GetComponent <Collider2D>();
     gameObject.AddComponent <PixelSnap>();
     init();
 }
    public void ResetObject()
    {
        if (spriteOutline == null)
        {
            spriteOutline = GetComponent <SpriteOutline>();
        }

        spriteOutline.enabled = false;
        playerIsPickingUp     = false;
    }
Beispiel #19
0
 private void OnMouseExit()
 {
     if (!so)
     {
         so = GetComponent <SpriteOutline>();
     }
     if (so && !Input.GetKey(KeyCode.LeftAlt))
     {
         so.DisableOutline();
     }
 }
    public static IEnumerator FlashOutlineWhiteForSeconds(SpriteOutline outline, float seconds)
    {
        var outlineColor = outline.color;

        outline.color = Color.white;
        outline.Regenerate();
        yield return(new WaitForSeconds(seconds));

        outline.color = outlineColor;
        outline.Regenerate();
    }
Beispiel #21
0
 void Awake()
 {
     AnimationEventManager.OnDamageTaken += Damage;
     spriteOutline   = GetComponentInChildren <SpriteOutline>();
     spriteRenderer  = GetComponentInChildren <SpriteRenderer>();
     spriteAnimator  = GetComponentInChildren <SpriteAnimator>();
     thisNPCHealth   = GetComponent <Health>();
     startingColor   = spriteRenderer.color;
     startingOutline = spriteOutline.outlineColor;
     damageParticle.collision.SetPlane(0, groundPlane);
 }
 protected virtual void Start()
 {
     renderer = GetComponent <SpriteRenderer>();
     if (renderer != null)
     {
         startColor = renderer.color;
     }
     outline = GetComponent <SpriteOutline>();
     if (outline != null)
     {
         outline.enabled = false;
     }
 }
Beispiel #23
0
    // Use this for initialization
    void Start()
    {
        spriteOutline = GetComponent <SpriteOutline> ();
        enemyCollider = GetComponent <Collider2D> ();
        target        = GameObject.Find("Fireplace");

        spriteOutline.enabled = false;

        Vector3 moveDirection = target.transform.position - transform.position;
        float   angle         = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;

        transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }
Beispiel #24
0
    private void setOutline(GameObject gobj, bool enabled)
    {
        SpriteOutline outline = gobj.GetComponent <SpriteOutline>();

        if (outline != null)
        {
            outline.enabled = enabled;
        }
        else
        {
            Debug.Log("Game object doesn't have outline component");
            Debug.Log(gobj);
        }
    }
Beispiel #25
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        EditorGUILayout.Space();

        GUIStyle hr = new GUIStyle(GUI.skin.box);

        hr.border.top    = 0;
        hr.border.bottom = 0;
        hr.margin.top    = 0;
        hr.margin.bottom = 8;
        hr.stretchWidth  = true;
        hr.fixedHeight   = 1;

        Color originalColor = GUI.color;

        GUI.color = Color.black;
        GUILayout.Box("", hr);
        GUI.color = originalColor;

        GUILayout.Label("Editor Actions:");

        if (GUILayout.Button("Regenerate"))
        {
            System.Array.ForEach(targets, target => {
                SpriteOutline outline = (SpriteOutline)target;
                outline.Regenerate();
            });
        }

        if (GUILayout.Button("Export"))
        {
            System.Array.ForEach(targets, target => {
                SpriteOutline outline = (SpriteOutline)target;
                outline.Export();
            });
        }

        if (GUILayout.Button("Clear"))
        {
            System.Array.ForEach(targets, target => {
                SpriteOutline outline = (SpriteOutline)target;
                outline.Clear();
            });
        }

        EditorGUILayout.Space();
    }
Beispiel #26
0
        public void SetBlockSelection(bool blockSelection)
        {
            if (TurnShift.Length > 0)
            {
                for (int i = 0; i < TurnShift.Length; i++)
                {
                    SpriteOutline so = TurnShift[i].GetComponentInChildren <SpriteOutline>();

                    if (so)
                    {
                        so.SelectBlock = blockSelection;
                    }
                }
            }
        }
    public virtual void AddHighlightComponent(bool enableComponent = false)
    {
        so = GetComponent <SpriteOutline>();
        if (so == null)
        {
            so         = gameObject.AddComponent <SpriteOutline>();
            so.enabled = false;
        }

        so.ChangeColour(0, 1.0f, 0.18f, 1.0f);
        if (enableComponent)
        {
            HighlightToSelect();
        }
    }
Beispiel #28
0
 // Use this for initialization
 void Start()
 {
     Char            = GetComponent <Character>();
     CombChar        = GetComponent <CombatChar>();
     outLine         = sprite.GetComponent <SpriteOutline>();
     partyNumberText = partyNumber.GetComponent <Text>();
     PartyManager.instance.Parties[0].Add(this);
     //Menu = GetComponentInChildren<Canvas>();
     //aiMenu = GetComponentInChildren<AiMenu>();
     wayPoints = new List <Vector2>();
     if (transform.name == "Ramiro")
     {
         // StartCoroutine (pathfinder.GetWaypoints(transform.position, testChar.transform.position));
     }
 }
Beispiel #29
0
    // Start is called before the first frame update
    public override void Start()
    {
        base.Start();

        SpawnManager.instance.RegisterEnemy(this);
        outline         = this.sprite.GetComponent <SpriteOutline>();
        outline.size    = 3;
        outline.enabled = hasShield;

        if (!outline.enabled)
        {
            outline.Clear();
        }
        ColorUtility.TryParseHtmlString(ShieldColorMap.map[this.shieldColor], out outline.color);
        outline.Regenerate();
    }
Beispiel #30
0
    // Use this for initialization
    void Awake()
    {
        C             = GetComponent <Character>();
        combatAI      = GetComponent <CombatAI>();
        sprite        = GetComponentInChildren <SpriteRenderer>().transform;
        spriteOutline = sprite.GetComponent <SpriteOutline>();
        spriteR       = sprite.GetComponent <SpriteRenderer>();
        initialPos    = sprite.position - transform.position;
        Weapons wep = Weapons.CreateWeaponBySize(Weapons.WeaponsSize.Light, 1);

        weapons.Add(wep);
        weap = wep.weapon.ToString();
        Armor armor = Armor.GetArmorByCat(Armor.ArmorCat.Light, 1);

        C.equipment[Slots.Chest] = armor;
    }